Changed small functions to methods

Added custom color function
This commit is contained in:
2024-09-07 20:09:29 +02:00
parent a9fb41cece
commit 7a2a136f30
33 changed files with 74 additions and 76 deletions

View File

@@ -2,14 +2,12 @@ import { anilist } from "anilist"
import { devMessage, embedColor } from "config/options.js"
import { SlashCommandBuilder } from "discord.js"
import { ICommand } from "interfaces"
import { capitalizeFirstLetter, removeIndents } from "utils/functions/funcs.js"
export default {
name: "anime",
description: "Anime subcommands",
public: true,
dev: false,
subcommands: true,
data: new SlashCommandBuilder()
.setName("anime")
@@ -59,14 +57,14 @@ export default {
const animeEpisodes = anime.episodes ? animeEpisodesRaw : "No episodes available"
const animeStartDate = [anime.startDate?.day || "??", anime.startDate?.month || "??", anime.startDate?.year || "????"].join(".")
const animeEndDate = [anime.endDate?.day || "??", anime.endDate?.month || "??", anime.endDate?.year || "????"].join(".")
const animeSeasonRaw = capitalizeFirstLetter(anime.season ?? "null") + " " + anime.startDate?.year
const animeSeasonRaw = anime.season?.capitalizeFirstLetter() + " " + anime.startDate?.year
const animeSeason = anime.season ? animeSeasonRaw : "No season available"
await interaction.editReply({
embeds: [{
title: romaji + " | " + english,
url: anime.siteUrl || "",
description: removeIndents(`
description: `
**Description:** ${animeDescription}
**Genres:** ${anime.genres.join(", ")}
@@ -76,7 +74,7 @@ export default {
**Season:** ${animeSeason}
**Start Date:** ${animeStartDate}
**End Date:** ${animeEndDate}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: anime.coverImage?.medium || ""

View File

@@ -2,7 +2,6 @@ import { devMessage, embedColor } from "config/options.js"
import { admin, helper } from "config/roles.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -102,12 +101,12 @@ export default {
icon_url: mod.user.avatarURL() || undefined
},
title: "Member Banned",
description: removeIndents(`
description: `
**User:** ${userMention(member.user.id)}
**Mod:** ${userMention(mod.user.id)}
**Reason:** ${reason}
**Messages Deleted:** ${messageDeletionDays} days
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.user.avatarURL() || ""

View File

@@ -5,7 +5,6 @@ import { ICommand } from "interfaces"
import { createRequire } from "node:module"
import os from "os"
import prettyMs from "pretty-ms"
import { removeIndents } from "utils/functions/funcs.js"
const require = createRequire(import.meta.url)
const { dependencies, devDependencies } = require("../../package.json")
@@ -46,7 +45,7 @@ export default {
await interaction.reply({
embeds: [{
title: "Bot Info",
description: removeIndents(`
description: `
__**Bot**__
> **Name**: \`${client.user!.username}\`
> **ID**: \`${client.user!.id}\`
@@ -67,7 +66,7 @@ export default {
> **Channels:** \`${client.channels.cache.size}\`
> **Users:** \`${client.users.cache.size}\`
> **Roles:** \`${client.guilds.cache.reduce((a, b) => a + b.roles.cache.size, 0)}\`
`),
`.removeIndents(),
thumbnail: {
url: client.user!.avatarURL() || ""
},

View File

@@ -1,7 +1,6 @@
import { embedColor } from "config/options.js"
import { channelMention, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -53,11 +52,11 @@ export default {
icon_url: interaction.user.avatarURL() || undefined
},
title: "Messages Cleared",
description: removeIndents(`
description: `
**Channel:** ${channelMention(channel.id)}
**Amount:** \`${messages.size}\` messages
**Mod:** ${userMention(interaction.user.id)}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: interaction.user.avatarURL() || ""

View File

@@ -2,7 +2,6 @@ import { devMessage, embedColor } from "config/options.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import verify from "schemas/verifyTag.js"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
import roleManage from "utils/functions/rolesmanage.js"
import { getIGN } from "utils/Hypixel.js"
@@ -58,12 +57,12 @@ export default {
name: mod.username,
icon_url: mod.avatarURL() || undefined
},
description: removeIndents(`
description: `
**User:** ${userMention(member.user.id)}
**Mod:** ${userMention(mod.id)}
**IGN:** \`${ign}\`
**UUID:** \`${uuid}\`
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.avatarURL() || ""

View File

@@ -3,7 +3,6 @@ import { waitingListRole } from "config/roles.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import verify from "schemas/verifyTag.js"
import { removeIndents } from "utils/functions/funcs.js"
import roleManage from "utils/functions/rolesmanage.js"
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel.js"
@@ -85,11 +84,11 @@ export default {
await interaction.editReply({
embeds: [{
description: removeIndents(`
description: `
${usermentioned} was given the \`Default Member\` role.
IGN: \`${ign}\`
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: head!
@@ -159,11 +158,11 @@ export default {
await interaction.editReply({
embeds: [{
description: removeIndents(`
description: `
${usermentioned} was given the \`${replyRank}\` role.
IGN: \`${ign}\`
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: head!

View File

@@ -2,7 +2,6 @@ import { devMessage, embedColor, hypixelGuildID } from "config/options.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import verify from "schemas/verifyTag.js"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
import roleManage from "utils/functions/rolesmanage.js"
import { getGuild, getHeadURL, getPlayer, getUUID } from "utils/Hypixel.js"
@@ -173,12 +172,12 @@ export default {
icon_url: mod.avatarURL() || undefined
},
title: "Force Verified",
description: removeIndents(`
description: `
**User:** ${userMention(user.id)}
**Mod:** ${userMention(mod.id)}
**IGN:** \`${player.displayname}\`
**UUID:** \`${uuid}\`
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.avatarURL() || ""

View File

@@ -1,7 +1,6 @@
import { devMessage, embedColor, instructionsgif } from "config/options.js"
import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
export default {
name: "instructions",
@@ -19,14 +18,14 @@ export default {
await interaction.reply({
embeds: [{
title: "Verification",
description: removeIndents(`
description: `
- Log onto hypixel.
- Right click with the head in your hotbar.
- Click on the social media icon.
- Click on the discord icon.
- Type your username in the chat and press enter.
- Run the \`/verify\` command in this channel.
`),
`.removeIndents(),
thumbnail: {
url: interaction.guild?.iconURL() || ""
},

View File

@@ -2,7 +2,6 @@ import { devMessage, embedColor } from "config/options.js"
import { admin, helper } from "config/roles.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -76,11 +75,11 @@ export default {
icon_url: mod.user.avatarURL() || undefined
},
title: "Member Kicked",
description: removeIndents(`
description: `
**User:** ${userMention(member.user.id)}
**Mod:** ${userMention(mod.user.id)}
**Reason:** ${reason}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.user.avatarURL() || ""

View File

@@ -1,7 +1,6 @@
import { embedColor } from "config/options.js"
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { removeIndents } from "utils/functions/funcs.js"
export default async function nowplaying(interaction: ChatInputCommandInteraction) {
await interaction.deferReply()
@@ -42,11 +41,11 @@ export default async function nowplaying(interaction: ChatInputCommandInteractio
await interaction.editReply({
embeds: [{
title: "Now Playing",
description: removeIndents(`
description: `
[${current.title}](${current.url})
${progressBar}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: current.thumbnail

View File

@@ -3,7 +3,6 @@ import { waitingListRole } from "config/roles.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import waitinglist from "schemas/waitinglistTag.js"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -58,11 +57,11 @@ export default {
icon_url: mod.avatarURL() || undefined
},
title: "Waiting List - Remove User",
description: removeIndents(`
description: `
**User:** ${userMention(member.user.id)}
**Reason:** ${reason}
**Mod:** ${userMention(mod.id)}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.avatarURL() || ""

View File

@@ -1,7 +1,6 @@
import { devMessage, embedColor } from "config/options.js"
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -49,11 +48,11 @@ export default {
icon_url: interaction.user.avatarURL() || undefined
},
title: "Nickname",
description: removeIndents(`
description: `
**User:** ${userMention(member.id)}
**Nickname:** ${nickname}
**Moderator:** ${userMention(interaction.user.id)}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: interaction.user.avatarURL() || ""

View File

@@ -1,7 +1,6 @@
import { devMessage, embedColor } from "config/options.js"
import { channelMention, ChannelType, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -55,11 +54,11 @@ export default {
icon_url: interaction.user.avatarURL() || undefined
},
title: "Slowmode Update",
description: removeIndents(`
description: `
**Channel:** ${channelMention(channel.id)}
**Slowmode:** ${seconds} seconds
**Mod:** ${userMention(interaction.user.id)}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: interaction.user.avatarURL() || ""

View File

@@ -3,7 +3,7 @@ import { ChatInputCommandInteraction, GuildMember } from "discord.js"
import { IGuildData } from "interfaces"
import verify from "schemas/verifyTag.js"
import env from "utils/Env.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
import roleManage from "utils/functions/rolesmanage.js"
import { getGuild, getIGN } from "utils/Hypixel.js"

View File

@@ -3,7 +3,6 @@ import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } fr
import { ICommand } from "interfaces"
import ms from "ms"
import prettyMs from "pretty-ms"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -144,12 +143,12 @@ export default {
icon_url: mod.user.avatarURL() || undefined
},
title: title,
description: removeIndents(`
description: `
**User:** ${userMention(target.id)}
${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"}
**Reason:** \`${reason}\`
**Mod:** ${userMention(mod.id)}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.user.avatarURL() || ""

View File

@@ -1,7 +1,6 @@
import { devMessage, embedColor } from "config/options.js"
import { PermissionFlagsBits, SlashCommandBuilder, User, userMention } from "discord.js"
import { ICommand } from "interfaces"
import { removeIndents } from "utils/functions/funcs.js"
import logToChannel from "utils/functions/logtochannel.js"
export default {
@@ -69,11 +68,11 @@ export default {
icon_url: mod.avatarURL() || undefined
},
title: "Member Unbanned",
description: removeIndents(`
description: `
**User:** ${userMention(user!.id)}
**Mod:** ${userMention(mod.id)}
**Reason:** ${reason}
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: mod.avatarURL() || ""

View File

@@ -3,7 +3,6 @@ import { waitingListRole } from "config/roles.js"
import { GuildMember, SlashCommandBuilder } from "discord.js"
import { ICommand } from "interfaces"
import verify from "schemas/verifyTag.js"
import { removeIndents } from "utils/functions/funcs.js"
import roleManage from "utils/functions/rolesmanage.js"
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel.js"
@@ -68,11 +67,11 @@ export default {
await interaction.editReply({
embeds: [{
description: removeIndents(`
description: `
Updated your roles to \`Default Member\`
IGN: \`${ign}\`
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: head!
@@ -143,11 +142,11 @@ export default {
await interaction.editReply({
embeds: [{
description: removeIndents(`
description: `
Updated your roles to \`${replyRank}\`
IGN: \`${ign}\`
`),
`.removeIndents(),
color: embedColor,
thumbnail: {
url: head!