aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-16 14:32:18 -0400
commit0e87bbd3940d89defcb04926587b35c8f4d1947f (patch)
treee50860d4dc25a11d4c3977b583284c4bcad1b077 /src/commands
parent661e4c9935aeb8760dafc7ced4bbec6cc356a033 (diff)
downloadtanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.gz
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.tar.bz2
tanzanite-0e87bbd3940d89defcb04926587b35c8f4d1947f.zip
remove util classes, move config out of src
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/channelPermissions.ts22
-rw-r--r--src/commands/admin/roleAll.ts22
-rw-r--r--src/commands/config/_customAutomodPhrases.ts2
-rw-r--r--src/commands/config/blacklist.ts41
-rw-r--r--src/commands/config/config.ts29
-rw-r--r--src/commands/config/disable.ts39
-rw-r--r--src/commands/config/features.ts10
-rw-r--r--src/commands/config/log.ts20
-rw-r--r--src/commands/dev/__template.ts14
-rw-r--r--src/commands/dev/debug.ts6
-rw-r--r--src/commands/dev/dm.ts8
-rw-r--r--src/commands/dev/eval.ts24
-rw-r--r--src/commands/dev/javascript.ts27
-rw-r--r--src/commands/dev/reload.ts22
-rw-r--r--src/commands/dev/say.ts17
-rw-r--r--src/commands/dev/servers.ts19
-rw-r--r--src/commands/dev/sh.ts42
-rw-r--r--src/commands/dev/superUser.ts30
-rw-r--r--src/commands/dev/syncAutomod.ts8
-rw-r--r--src/commands/dev/test.ts29
-rw-r--r--src/commands/fun/coinFlip.ts4
-rw-r--r--src/commands/fun/dice.ts4
-rw-r--r--src/commands/fun/eightBall.ts4
-rw-r--r--src/commands/fun/minesweeper.ts18
-rw-r--r--src/commands/info/avatar.ts8
-rw-r--r--src/commands/info/botInfo.ts23
-rw-r--r--src/commands/info/color.ts22
-rw-r--r--src/commands/info/guildInfo.ts50
-rw-r--r--src/commands/info/help.ts27
-rw-r--r--src/commands/info/icon.ts10
-rw-r--r--src/commands/info/links.ts6
-rw-r--r--src/commands/info/ping.ts10
-rw-r--r--src/commands/info/pronouns.ts26
-rw-r--r--src/commands/info/snowflake.ts49
-rw-r--r--src/commands/info/userInfo.ts81
-rw-r--r--src/commands/leveling/leaderboard.ts21
-rw-r--r--src/commands/leveling/level.ts11
-rw-r--r--src/commands/leveling/levelRoles.ts33
-rw-r--r--src/commands/leveling/setLevel.ts20
-rw-r--r--src/commands/leveling/setXp.ts24
-rw-r--r--src/commands/moderation/_activePunishments.ts6
-rw-r--r--src/commands/moderation/ban.ts35
-rw-r--r--src/commands/moderation/block.ts33
-rw-r--r--src/commands/moderation/evidence.ts34
-rw-r--r--src/commands/moderation/hideCase.ts21
-rw-r--r--src/commands/moderation/kick.ts21
-rw-r--r--src/commands/moderation/lockdown.ts31
-rw-r--r--src/commands/moderation/massBan.ts23
-rw-r--r--src/commands/moderation/massEvidence.ts29
-rw-r--r--src/commands/moderation/modlog.ts46
-rw-r--r--src/commands/moderation/mute.ts38
-rw-r--r--src/commands/moderation/purge.ts23
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts27
-rw-r--r--src/commands/moderation/role.ts36
-rw-r--r--src/commands/moderation/slowmode.ts27
-rw-r--r--src/commands/moderation/timeout.ts28
-rw-r--r--src/commands/moderation/unban.ts21
-rw-r--r--src/commands/moderation/unblock.ts30
-rw-r--r--src/commands/moderation/unlockdown.ts14
-rw-r--r--src/commands/moderation/unmute.ts27
-rw-r--r--src/commands/moderation/untimeout.ts23
-rw-r--r--src/commands/moderation/warn.ts21
-rw-r--r--src/commands/moulberry-bush/capePermissions.ts31
-rw-r--r--src/commands/moulberry-bush/capes.ts17
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts6
-rw-r--r--src/commands/moulberry-bush/moulHammer.ts6
-rw-r--r--src/commands/moulberry-bush/report.ts39
-rw-r--r--src/commands/moulberry-bush/rule.ts14
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts18
-rw-r--r--src/commands/utilities/_poll.ts10
-rw-r--r--src/commands/utilities/activity.ts26
-rw-r--r--src/commands/utilities/calculator.ts29
-rw-r--r--src/commands/utilities/decode.ts26
-rw-r--r--src/commands/utilities/hash.ts4
-rw-r--r--src/commands/utilities/highlight-!.ts4
-rw-r--r--src/commands/utilities/highlight-add.ts14
-rw-r--r--src/commands/utilities/highlight-block.ts26
-rw-r--r--src/commands/utilities/highlight-clear.ts8
-rw-r--r--src/commands/utilities/highlight-matches.ts12
-rw-r--r--src/commands/utilities/highlight-remove.ts8
-rw-r--r--src/commands/utilities/highlight-show.ts6
-rw-r--r--src/commands/utilities/highlight-unblock.ts21
-rw-r--r--src/commands/utilities/price.ts18
-rw-r--r--src/commands/utilities/remind.ts31
-rw-r--r--src/commands/utilities/reminders.ts23
-rw-r--r--src/commands/utilities/steal.ts33
-rw-r--r--src/commands/utilities/suicide.ts6
-rw-r--r--src/commands/utilities/uuid.ts22
-rw-r--r--src/commands/utilities/viewRaw.ts28
-rw-r--r--src/commands/utilities/whoHasRole.ts27
-rw-r--r--src/commands/utilities/wolframAlpha.ts33
91 files changed, 1267 insertions, 755 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index f6240a5..12245a9 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,4 +1,14 @@
-import { BushCommand, ButtonPaginator, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ Arg,
+ BushCommand,
+ ButtonPaginator,
+ clientSendAndPermCheck,
+ emojis,
+ formatError,
+ type ArgType,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
@@ -15,7 +25,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
{
id: 'target',
description: 'The user/role to change the permissions of.',
- type: util.arg.union('member', 'role'),
+ type: Arg.union('member', 'role'),
readableType: 'member|role',
prompt: 'What user/role would you like to change?',
retry: '{error} Choose a valid user/role to change.',
@@ -48,7 +58,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
]
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
+ clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
userPermissions: [PermissionFlagsBits.Administrator],
channel: 'guild',
slash: true,
@@ -64,9 +74,9 @@ export default class ChannelPermissionsCommand extends BushCommand {
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
const permission = message.util.isSlashMessage(message)
- ? await util.arg.cast('permission', message, args.permission)
+ ? await Arg.cast('permission', message, args.permission)
: args.permission;
- if (!permission) return await message.util.reply(`${util.emojis.error} Invalid permission.`);
+ if (!permission) return await message.util.reply(`${emojis.error} Invalid permission.`);
const failedChannels = [];
for (const [, channel] of message.guild.channels.cache) {
try {
@@ -79,7 +89,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
{ reason: 'Changing overwrites for mass channel perms command' }
);
} catch (e) {
- void client.console.error('channelPermissions', util.formatError(e, false));
+ void client.console.error('channelPermissions', formatError(e, false));
failedChannels.push(channel);
}
}
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts
index 80952cc..c731f08 100644
--- a/src/commands/admin/roleAll.ts
+++ b/src/commands/admin/roleAll.ts
@@ -1,4 +1,12 @@
-import { AllowedMentions, BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ AllowedMentions,
+ BushCommand,
+ clientSendAndPermCheck,
+ emojis,
+ type ArgType,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js';
@@ -32,7 +40,7 @@ export default class RoleAllCommand extends BushCommand {
}
],
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]),
+ clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]),
userPermissions: [PermissionFlagsBits.Administrator],
typing: true,
slash: true,
@@ -43,11 +51,11 @@ export default class RoleAllCommand extends BushCommand {
public override async exec(message: CommandMessage | SlashMessage, args: { role: ArgType<'role'>; bots: ArgType<'flag'> }) {
assert(message.inGuild());
if (!message.member!.permissions.has(PermissionFlagsBits.Administrator) && !message.member!.user.isOwner())
- return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`);
+ return await message.util.reply(`${emojis.error} You must have admin perms to use this command.`);
if (message.util.isSlashMessage(message)) await message.interaction.deferReply();
if (args.role.comparePositionTo(message.guild.members.me!.roles.highest) >= 0 && !args.role) {
- return await message.util.reply(`${util.emojis.error} I cannot assign a role higher or equal to my highest role.`);
+ return await message.util.reply(`${emojis.error} I cannot assign a role higher or equal to my highest role.`);
}
let members = await message.guild.members.fetch();
@@ -62,7 +70,7 @@ export default class RoleAllCommand extends BushCommand {
return true;
});
- await message.util.reply(`${util.emojis.loading} adding roles to ${members.size} members`);
+ await message.util.reply(`${emojis.loading} adding roles to ${members.size} members`);
const promises = members.map((member: GuildMember) => {
return member.roles.add(args.role, `RoleAll Command - triggered by ${message.author.tag} (${message.author.id})`);
@@ -72,7 +80,7 @@ export default class RoleAllCommand extends BushCommand {
if (!failed.length) {
await message.util.sendNew({
- content: `${util.emojis.success} Finished adding <@&${args.role.id}> to **${members.size}** member${
+ content: `${emojis.success} Finished adding <@&${args.role.id}> to **${members.size}** member${
members.size > 1 ? 's' : ''
}.`,
allowedMentions: AllowedMentions.none()
@@ -80,7 +88,7 @@ export default class RoleAllCommand extends BushCommand {
} else {
const array = [...members.values()];
await message.util.sendNew({
- content: `${util.emojis.warn} Finished adding <@&${args.role.id}> to **${members.size - failed.length}** member${
+ content: `${emojis.warn} Finished adding <@&${args.role.id}> to **${members.size - failed.length}** member${
members.size - failed.length > 1 ? 's' : ''
}! Failed members:\n${failed.map((_, index) => `<@${array[index].id}>`).join(' ')}`,
allowedMentions: AllowedMentions.none()
diff --git a/src/commands/config/_customAutomodPhrases.ts b/src/commands/config/_customAutomodPhrases.ts
index 13887ae..d60688c 100644
--- a/src/commands/config/_customAutomodPhrases.ts
+++ b/src/commands/config/_customAutomodPhrases.ts
@@ -30,7 +30,7 @@
// ],
// slash: true,
// channel: 'guild',
-// clientPermissions: (m) => util.clientSendAndPermCheck(m),
+// clientPermissions: (m) => clientSendAndPermCheck(m),
// userPermissions: [PermissionFlagsBits.ManageGuild]
// });
// }
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index de457c0..80acd0b 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -1,4 +1,17 @@
-import { AllowedMentions, BushCommand, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
+import {
+ addOrRemoveFromArray,
+ AllowedMentions,
+ Arg,
+ BushCommand,
+ clientSendAndPermCheck,
+ emojis,
+ format,
+ getGlobal,
+ setGlobal,
+ type ArgType,
+ type CommandMessage,
+ type SlashMessage
+} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, GuildMember, PermissionFlagsBits, User } from 'discord.js';
@@ -23,7 +36,7 @@ export default class BlacklistCommand extends BushCommand {
{
id: 'target',
description: 'The channel/user to blacklist.',
- type: util.arg.union('channel', 'user'),
+ type: Arg.union('channel', 'user'),
readableType: 'channel|user',
prompt: 'What channel or user that you would like to blacklist/unblacklist?',
retry: '{error} Pick a valid user or channel.',
@@ -41,7 +54,7 @@ export default class BlacklistCommand extends BushCommand {
}
],
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: [PermissionFlagsBits.ManageGuild]
});
}
@@ -59,26 +72,26 @@ export default class BlacklistCommand extends BushCommand {
const global = args.global && message.author.isOwner();
const target =
typeof args.target === 'string'
- ? (await util.arg.cast('textChannel', message, args.target)) ?? (await util.arg.cast('user', message, args.target))
+ ? (await Arg.cast('textChannel', message, args.target)) ?? (await Arg.cast('user', message, args.target))
: args.target;
- if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`);
+ if (!target) return await message.util.reply(`${emojis.error} Choose a valid channel or user.`);
const targetID = target.id;
if (!message.inGuild() && !global)
- return await message.util.reply(`${util.emojis.error} You have to be in a guild to disable commands.`);
+ return await message.util.reply(`${emojis.error} You have to be in a guild to disable commands.`);
if (!global) assert(message.inGuild());
const blacklistedUsers = global
- ? util.getGlobal('blacklistedUsers')
+ ? getGlobal('blacklistedUsers')
: (await message.guild!.getSetting('blacklistedChannels')) ?? [];
const blacklistedChannels = global
- ? util.getGlobal('blacklistedChannels')
+ ? getGlobal('blacklistedChannels')
: (await message.guild!.getSetting('blacklistedUsers')) ?? [];
if (action === 'toggle') {
action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist';
}
- const newValue = util.addOrRemoveFromArray(
+ const newValue = addOrRemoveFromArray(
action === 'blacklist' ? 'add' : 'remove',
target instanceof User ? blacklistedUsers : blacklistedChannels,
targetID
@@ -87,22 +100,22 @@ export default class BlacklistCommand extends BushCommand {
const key = target instanceof User ? 'blacklistedUsers' : 'blacklistedChannels';
const success = await (global
- ? util.setGlobal(key, newValue)
+ ? setGlobal(key, newValue)
: message.guild!.setSetting(key, newValue, message.member as GuildMember)
).catch(() => false);
if (!success)
return await message.util.reply({
- content: `${util.emojis.error} There was an error${global ? ' globally' : ''} ${action}ing ${util.format.input(
+ content: `${emojis.error} There was an error${global ? ' globally' : ''} ${action}ing ${format.input(
target instanceof User ? target.tag : target.name
)}.`,
allowedMentions: AllowedMentions.none()
});
else
return await message.util.reply({
- content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(
- target instanceof User ? target.tag : target.name
- )}${global ? ' globally' : ''}.`,
+ content: `${emojis.success} Successfully ${action}ed ${format.input(target instanceof User ? target.tag : target.name)}${
+ global ? ' globally' : ''
+ }.`,
allowedMentions: AllowedMentions.none()
});
}
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 689a3af..f0db467 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -1,7 +1,14 @@
import {
+ addOrRemoveFromArray,
BushCommand,
+ clientSendAndPermCheck,
+ colors,
+ emojis,
GuildNoArraySetting,
guildSettingsObj,
+ inspectAndRedact,
+ oxford,
+ prefix,
settingsArr,
type ArgType,
type CommandMessage,
@@ -145,7 +152,7 @@ export default class ConfigCommand extends BushCommand {
};
}),
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ clientPermissions: (m) => clientSendAndPermCheck(m),
userPermissions: [PermissionFlagsBits.ManageGuild]
});
}
@@ -171,11 +178,11 @@ export default class ConfigCommand extends BushCommand {
id: 'action',
type: actionType,
prompt: {
- start: `Would you like to ${util.oxford(
+ start: `Would you like