aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/extensions.json6
-rw-r--r--package.json1
-rw-r--r--src/commands/dev/eval.ts32
-rw-r--r--src/commands/dev/setLevel.ts13
-rw-r--r--src/commands/info/botInfo.ts19
-rw-r--r--src/commands/info/ping.ts26
-rw-r--r--src/commands/info/pronouns.ts4
-rw-r--r--src/commands/moderation/ban.ts40
-rw-r--r--src/commands/moderation/kick.ts17
-rw-r--r--src/commands/moderation/modlog.ts19
-rw-r--r--src/commands/moderation/role.ts21
-rw-r--r--src/commands/moderation/warn.ts12
-rw-r--r--src/commands/moulberry-bush/capePerms.ts12
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts14
-rw-r--r--src/commands/moulberry-bush/level.ts9
-rw-r--r--src/commands/moulberry-bush/rule.ts5
-rw-r--r--src/commands/server-config/prefix.ts11
-rw-r--r--src/lib/extensions/BushClient.ts8
-rw-r--r--src/lib/extensions/Util.ts27
-rw-r--r--src/lib/models/Ban.ts5
-rw-r--r--src/lib/models/Modlog.ts9
-rw-r--r--src/lib/utils/Logger.ts4
-rw-r--r--src/listeners/client/syncSlashCommands.ts5
-rw-r--r--src/listeners/commands/commandBlocked.ts6
-rw-r--r--src/listeners/commands/commandError.ts6
-rw-r--r--src/listeners/commands/slashCommandError.ts6
-rw-r--r--src/listeners/message/level.ts3
-rw-r--r--src/tasks/unban.ts9
28 files changed, 90 insertions, 259 deletions
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 1fcdf78..5c4d931 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -1,7 +1,3 @@
{
- "recommendations": [
- "arcanis.vscode-zipfs",
- "dbaeumer.vscode-eslint",
- "esbenp.prettier-vscode"
- ]
+ "recommendations": ["arcanis.vscode-zipfs", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
diff --git a/package.json b/package.json
index 75fd6c2..16d0436 100644
--- a/package.json
+++ b/package.json
@@ -69,6 +69,7 @@
]
},
"prettier": {
+ "printWidth": 100,
"useTabs": true,
"quoteProps": "consistent",
"singleQuote": true,
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 83e63f6..cb7a95c 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -70,32 +70,24 @@ export default class EvalCommand extends BushCommand {
output = eval(code);
output = await output;
if (typeof output !== 'string') output = inspect(output, { depth });
- output = output.replace(
- new RegExp(this.client.token, 'g'),
- '[token omitted]'
- );
+ output = output.replace(new RegExp(this.client.token, 'g'), '[token omitted]');
output = clean(output);
embed
.setTitle('✅ Evaled code successfully')
.addField(
'📥 Input',
code.length > 1012
- ? 'Too large to display. Hastebin: ' +
- (await this.client.util.haste(code))
+ ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(code))
: '```js\n' + code + '```'
)
.addField(
'📤 Output',
output.length > 1012
- ? 'Too large to display. Hastebin: ' +
- (await this.client.util.haste(output))
+ ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(output))
: '```js\n' + output + '```'
)
.setColor('#66FF00')
- .setFooter(
- message.author.username,
- message.author.displayAvatarURL({ dynamic: true })
- )
+ .setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp();
} catch (e) {
embed
@@ -103,25 +95,17 @@ export default class EvalCommand extends BushCommand {
.addField(
'📥 Input',
code.length > 1012
- ? 'Too large to display. Hastebin: ' +
- (await this.client.util.haste(code))
+ ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(code))
: '```js\n' + code + '```'
)
.addField(
'📤 Output',
e.length > 1012
- ? 'Too large to display. Hastebin: ' +
- (await this.client.util.haste(e))
- : '```js\n' +
- e +
- '```Full stack:' +
- (await this.client.util.haste(e.stack))
+ ? 'Too large to display. Hastebin: ' + (await this.client.util.haste(e))
+ : '```js\n' + e + '```Full stack:' + (await this.client.util.haste(e.stack))
)
.setColor('#FF0000')
- .setFooter(
- message.author.username,
- message.author.displayAvatarURL({ dynamic: true })
- )
+ .setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp();
}
if (!silent) {
diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts
index d1701c5..e57e2f8 100644
--- a/src/commands/dev/setLevel.ts
+++ b/src/commands/dev/setLevel.ts
@@ -23,8 +23,7 @@ export default class SetLevelCommand extends BushCommand {
type: 'user',
prompt: {
start: 'What user would you like to change the level of?',
- retry:
- 'Invalid user. What user would you like to change the level of?'
+ retry: 'Invalid user. What user would you like to change the level of?'
}
},
{
@@ -68,10 +67,7 @@ export default class SetLevelCommand extends BushCommand {
return `Successfully set level of <@${user.id}> to \`${level}\` (\`${levelEntry.xp}\` XP)`;
}
- async exec(
- message: Message,
- { user, level }: { user: User; level: number }
- ): Promise<void> {
+ async exec(message: Message, { user, level }: { user: User; level: number }): Promise<void> {
await message.util.send(await this.setLevel(user, level), {
allowedMentions: AllowedMentions.none()
});
@@ -79,10 +75,7 @@ export default class SetLevelCommand extends BushCommand {
async execSlash(
message: CommandInteraction,
- {
- user,
- level
- }: { user: SlashCommandOption<void>; level: SlashCommandOption<number> }
+ { user, level }: { user: SlashCommandOption<void>; level: SlashCommandOption<number> }
): Promise<void> {
await message.reply(await this.setLevel(user.user, level.value), {
allowedMentions: AllowedMentions.none()
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index 779b318..0226edc 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -19,12 +19,14 @@ export default class BotInfoCommand extends BushCommand {
const owners = (await this.client.util.mapIDs(this.client.ownerID))
.map((u) => u.tag)
.join('\n');
- const currentCommit = (
- await this.client.util.shell('git rev-parse HEAD')
- ).stdout.replace('\n', '');
- const repoUrl = (
- await this.client.util.shell('git remote get-url origin')
- ).stdout.replace('\n', '');
+ const currentCommit = (await this.client.util.shell('git rev-parse HEAD')).stdout.replace(
+ '\n',
+ ''
+ );
+ const repoUrl = (await this.client.util.shell('git remote get-url origin')).stdout.replace(
+ '\n',
+ ''
+ );
const embed = new MessageEmbed()
.setTitle('Bot Info:')
.addFields([
@@ -46,10 +48,7 @@ export default class BotInfoCommand extends BushCommand {
},
{
name: 'Current commit',
- value: `[${currentCommit.substring(
- 0,
- 7
- )}](${repoUrl}/commit/${currentCommit})`
+ value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`
}
])
.setTimestamp();
diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts
index e0bbfc7..9468722 100644
--- a/src/commands/info/ping.ts
+++ b/src/commands/info/ping.ts
@@ -21,20 +21,13 @@ export default class PingCommand extends BushCommand {
const timestamp: number = message.editedTimestamp
? message.editedTimestamp
: message.createdTimestamp;
- const botLatency = `\`\`\`\n ${Math.floor(
- sentMessage.createdTimestamp - timestamp
- )}ms \`\`\``;
- const apiLatency = `\`\`\`\n ${Math.round(
- message.client.ws.ping
- )}ms \`\`\``;
+ const botLatency = `\`\`\`\n ${Math.floor(sentMessage.createdTimestamp - timestamp)}ms \`\`\``;
+ const apiLatency = `\`\`\`\n ${Math.round(message.client.ws.ping)}ms \`\`\``;
const embed = new MessageEmbed()
.setTitle('Pong! 🏓')
.addField('Bot Latency', botLatency, true)
.addField('API Latency', apiLatency, true)
- .setFooter(
- message.author.username,
- message.author.displayAvatarURL({ dynamic: true })
- )
+ .setFooter(message.author.username, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp();
await sentMessage.edit({
content: null,
@@ -45,21 +38,14 @@ export default class PingCommand extends BushCommand {
public async execSlash(message: CommandInteraction): Promise<void> {
const timestamp1 = message.createdTimestamp;
await message.reply('Pong!');
- const timestamp2 = await message
- .fetchReply()
- .then((m) => (m as Message).createdTimestamp);
- const botLatency = `\`\`\`\n ${Math.floor(
- timestamp2 - timestamp1
- )}ms \`\`\``;
+ const timestamp2 = await message.fetchReply().then((m) => (m as Message).createdTimestamp);
+ const botLatency = `\`\`\`\n ${Math.floor(timestamp2 - timestamp1)}ms \`\`\``;
const apiLatency = `\`\`\`\n ${Math.round(this.client.ws.ping)}ms \`\`\``;
const embed = new MessageEmbed()
.setTitle('Pong! 🏓')
.addField('Bot Latency', botLatency, true)
.addField('API Latency', apiLatency, true)
- .setFooter(
- message.user.username,
- message.user.displayAvatarURL({ dynamic: true })
- )
+ .setFooter(message.user.username, message.user.displayAvatarURL({ dynamic: true }))
.setTimestamp();
await message.editReply({
content: null,
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index 2c1d5f2..ca70ff0 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -66,9 +66,7 @@ export default class PronounsCommand extends BushCommand {
): Promise<void> {
try {
const apiRes: { pronouns: pronounsType } = await got
- .get(
- `https://pronoundb.org/api/v1/lookup?platform=discord&id=${user.id}`
- )
+ .get(`https://pronoundb.org/api/v1/lookup?platform=discord&id=${user.id}`)
.json();
if (message instanceof Message) {
message.reply(
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index feb020b..05c26e0 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -45,13 +45,9 @@ export default class BanCommand extends BushCommand {
clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['BAN_MEMBERS'],
description: {
- content:
- 'Ban a member and log it in modlogs (with optional time to unban)',
+ content: 'Ban a member and log it in modlogs (with optional time to unban)',
usage: 'ban <member> <reason> [--time]',
- examples: [
- 'ban @Tyman being cool',
- 'ban @Tyman being cool --time 7days'
- ]
+ examples: ['ban @Tyman being cool', 'ban @Tyman being cool --time 7days']
},
slashCommandOptions: [
{
@@ -69,8 +65,7 @@ export default class BanCommand extends BushCommand {
{
type: ApplicationCommandOptionType.STRING,
name: 'time',
- description:
- 'The time the user should be banned for (default permanent)',
+ description: 'The time the user should be banned for (default permanent)',
required: false
}
]
@@ -119,10 +114,7 @@ export default class BanCommand extends BushCommand {
reason,
type: ModlogType.TEMPBAN,
duration: duration.asMilliseconds(),
- moderator:
- message instanceof CommandInteraction
- ? message.user.id
- : message.author.id
+ moderator: message instanceof CommandInteraction ? message.user.id : message.author.id
});
banEntry = Ban.build({
user: user.id,
@@ -137,10 +129,7 @@ export default class BanCommand extends BushCommand {
guild: message.guild.id,
reason,
type: ModlogType.BAN,
- moderator:
- message instanceof CommandInteraction
- ? message.user.id
- : message.author.id
+ moderator: message instanceof CommandInteraction ? message.user.id : message.author.id
});
banEntry = Ban.build({
user: user.id,
@@ -159,9 +148,7 @@ export default class BanCommand extends BushCommand {
try {
await user.send(
`You were banned in ${message.guild.name} ${
- translatedTime.length >= 1
- ? `for ${translatedTime.join(', ')}`
- : 'permanently'
+ translatedTime.length >= 1 ? `for ${translatedTime.join(', ')}` : 'permanently'
} with reason \`${reason || 'No reason given'}\``
);
} catch (e) {
@@ -169,15 +156,11 @@ export default class BanCommand extends BushCommand {
}
await message.guild.members.ban(user, {
reason: `Banned by ${
- message instanceof CommandInteraction
- ? message.user.tag
- : message.author.tag
+ message instanceof CommandInteraction ? message.user.tag : message.author.tag
} with ${reason ? `reason ${reason}` : 'no reason'}`
});
yield `Banned <@!${user.id}> ${
- translatedTime.length >= 1
- ? `for ${translatedTime.join(', ')}`
- : 'permanently'
+ translatedTime.length >= 1 ? `for ${translatedTime.join(', ')}` : 'permanently'
} with reason \`${reason || 'No reason given'}\``;
} catch {
yield 'Error banning :/';
@@ -190,12 +173,7 @@ export default class BanCommand extends BushCommand {
message: Message,
{ user, reason, time }: { user: User; reason?: string; time?: string }
): Promise<void> {
- for await (const response of this.genResponses(
- message,
- user,
- reason,
- time
- )) {
+ for await (const response of this.genResponses(message, user, reason, time)) {
await message.util.send(response);
}
}
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 58cf52e..f3ee44c 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -65,8 +65,7 @@ export default class KickCommand extends BushCommand {
modlogEnry = Modlog.build({
user: user.id,
guild: message.guild.id,
- moderator:
- message instanceof Message ? message.author.id : message.user.id,
+ moderator: message instanceof Message ? message.author.id : message.user.id,
type: ModlogType.KICK,
reason
});
@@ -78,27 +77,23 @@ export default class KickCommand extends BushCommand {
}
try {
await user.send(
- `You were kicked in ${message.guild.name} with reason \`${
- reason || 'No reason given'
- }\``
+ `You were kicked in ${message.guild.name} with reason \`${reason || 'No reason given'}\``
);
} catch (e) {
yield 'Error sending message to user';
}
try {
await user.kick(
- `Kicked by ${
- message instanceof Message ? message.author.tag : message.user.tag
- } with ${reason ? `reason ${reason}` : 'no reason'}`
+ `Kicked by ${message instanceof Message ? message.author.tag : message.user.tag} with ${
+ reason ? `reason ${reason}` : 'no reason'
+ }`
);
} catch {
yield 'Error kicking :/';
await modlogEnry.destroy();
return;
}
- yield `Kicked <@!${user.id}> with reason \`${
- reason || 'No reason given'
- }\``;
+ yield `Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``;
}
async exec(
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index 2df4745..c4eb46a 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -53,10 +53,7 @@ export default class ModlogCommand extends BushCommand {
return { search, page };
}
}
- async exec(
- message: Message,
- { search, page }: { search: string; page: number }
- ): Promise<void> {
+ async exec(message: Message, { search, page }: { search: string; page: number }): Promise<void> {
const foundUser = await this.client.util.resolveUserAsync(search);
if (foundUser) {
const logs = await Modlog.findAll({
@@ -73,11 +70,7 @@ export default class ModlogCommand extends BushCommand {
Type: ${log.type.toLowerCase()}
User: <@!${log.user}> (${log.user})
Moderator: <@!${log.moderator}> (${log.moderator})
- Duration: ${
- log.duration
- ? moment.duration(log.duration, 'milliseconds').humanize()
- : 'N/A'
- }
+ Duration: ${log.duration ? moment.duration(log.duration, 'milliseconds').humanize() : 'N/A'}
Reason: ${log.reason || 'None given'}
${this.client.util.ordinal(logs.indexOf(log) + 1)} action
`);
@@ -87,9 +80,7 @@ export default class ModlogCommand extends BushCommand {
(e, i) =>
new MessageEmbed({
title: `Modlogs page ${i + 1}`,
- description: e.join(
- '\n-------------------------------------------------------\n'
- ),
+ description: e.join('\n-------------------------------------------------------\n'),
footer: {
text: `Page ${i + 1}/${chunked.length}`
}
@@ -120,9 +111,7 @@ export default class ModlogCommand extends BushCommand {
{
name: 'Duration',
value: `${
- entry.duration
- ? moment.duration(entry.duration, 'milliseconds').humanize()
- : 'N/A'
+ entry.duration ? moment.duration(entry.duration, 'milliseconds').humanize() : 'N/A'
}`,
inline: true
},
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index d5948c3..f03e0ad 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -22,13 +22,7 @@ export default class RoleCommand extends BushCommand {
'No Links': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'No Bots': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'No VC': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
- 'No Giveaways': [
- '*',
- 'Admin Perms',
- 'Sr. Moderator',
- 'Moderator',
- 'Helper'
- ],
+ 'No Giveaways': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator', 'Helper'],
'No Support': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'Giveaway Donor': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'Giveaway (200m)': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
@@ -95,9 +89,7 @@ export default class RoleCommand extends BushCommand {
!message.member.permissions.has('MANAGE_ROLES') &&
!this.client.ownerID.includes(message.author.id)
) {
- const mappedRole = this.client.util.moulberryBushRoleMap.find(
- (m) => m.id === role.id
- );
+ const mappedRole = this.client.util.moulberryBushRoleMap.find((m) => m.id === role.id);
if (!mappedRole || !this.roleWhitelist[mappedRole.name]) {
return message.util.reply(
`<:error:837123021016924261> <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`,
@@ -107,14 +99,9 @@ export default class RoleCommand extends BushCommand {
);
}
const allowedRoles = this.roleWhitelist[mappedRole.name].map((r) => {
- return this.client.util.moulberryBushRoleMap.find((m) => m.name === r)
- .id;
+ return this.client.util.moulberryBushRoleMap.find((m) => m.name === r).id;
});
- if (
- !message.member.roles.cache.some((role) =>
- allowedRoles.includes(role.id)
- )
- ) {
+ if (!message.member.roles.cache.some((role) => allowedRoles.includes(role.id))) {
return message.util.reply(
`<:error:837123021016924261> <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`,
{
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index a61eef3..5651830 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -48,21 +48,15 @@ export default class WarnCommand extends BushCommand {
});
await entry.save();
} catch (e) {
- await message.util.send(
- 'Error saving to database, please contact the developers'
- );
+ await message.util.send('Error saving to database, please contact the developers');
return;
}
try {
- await member.send(
- `You were warned in ${message.guild.name} for reason "${reason}".`
- );
+ await member.send(`You were warned in ${message.guild.name} for reason "${reason}".`);
} catch (e) {
await message.util.send('Error messaging user, warning still saved.');
return;
}
- await message.util.send(
- `${member.user.tag} was warned for reason "${reason}".`
- );
+ await message.util.send(`${member.user.tag} was warned for reason "${reason}".`);
}
}
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts
index fdb5caf..92ccd73 100644
--- a/src/commands/moulberry-bush/capePerms.ts
+++ b/src/commands/moulberry-bush/capePerms.ts
@@ -70,8 +70,7 @@ export default class CapePermissionsCommand extends BushCommand {
{
type: ApplicationCommandOptionType.STRING,
name: 'user',
- description:
- 'The username of the player to see the cape permissions of',
+ description: 'The username of the player to see the cape permissions of',
required: true
}
]
@@ -86,9 +85,7 @@ export default class CapePermissionsCommand extends BushCommand {
}
try {
- capeperms = await got
- .get('http://moulberry.codes/permscapes.json')
- .json();
+ capeperms = await got.get('http://moulberry.codes/permscapes.json').json();
} catch (error) {
capeperms = null;
}
@@ -110,10 +107,7 @@ export default class CapePermissionsCommand extends BushCommand {
}
}
}
- public async exec(
- message: Message,
- { user }: { user: string }
- ): Promise<void> {
+ public async exec(message: Message, { user }: { user: string }): Promise<void> {
await message.reply(await this.getResponse(user));
}
diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts
index e6fdd9a..06cb254 100644
--- a/src/commands/moulberry-bush/giveawayPing.ts
+++ b/src/commands/moulberry-bush/giveawayPing.ts
@@ -36,21 +36,17 @@ export default class GiveawayPingCommand extends BushCommand {
return message.reply(
"<:error:837123021016924261> This command may only be run in Moulberry's Bush."
);
- if (
- !['767782084981817344', '833855738501267456'].includes(message.channel.id)
- )
+ if (!['767782084981817344', '833855738501267456'].includes(message.channel.id))
return message.reply(
'<:error:837123021016924261> This command may only be run in giveaway channels.'
);
await message.delete().catch(() => undefined);
- const webhooks = await (
- message.channel as TextChannel | NewsChannel
- ).fetchWebhooks();
+ const webhooks = await (message.channel as TextChannel | NewsChannel).fetchWebhooks();
let webhookClient: WebhookClient;
if (webhooks.size < 1) {
- const webhook = await (
- message.channel as TextChannel | NewsChannel
- ).createWebhook('Giveaway ping webhook');
+ const webhook = await (message.channel as TextChannel | NewsChannel).createWebhook(
+ 'Giveaway ping webhook'
+ );
webhookClient = new WebhookClient(webhook.id, webhook.token);
} else {
const webhook = webhooks.first();
diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts
index decac8a..74d6cf4 100644
--- a/src/commands/moulberry-bush/level.ts
+++ b/src/commands/moulberry-bush/level.ts
@@ -22,8 +22,7 @@ export default class LevelCommand extends BushCommand {
type: 'user',
prompt: {
start: 'What user would you like to see the level of?',
- retry:
- 'Invalid user. What user would you like to see the level of?',
+ retry: 'Invalid user. What user would you like to see the level of?',
optional: true
}
}
@@ -42,9 +41,9 @@ export default class LevelCommand extends BushCommand {
private async getResponse(user: User): Promise<string> {
const userLevelRow = await Level.findByPk(user.id);
if (userLevelRow) {
- return `${user ? `${user.tag}'s` : 'Your'} level is ${
- userLevelRow.level
- } (${userLevelRow.xp} XP)`;
+ return `${user ? `${user.tag}'s` : 'Your'} level is ${userLevelRow.level} (${
+ userLevelRow.xp
+ } XP)`;
} else {
return `${user ? `${user.tag} does` : 'You do'} not have a level yet!`;
}
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts
index 69dcb6e..6984603 100644
--- a/src/commands/moulberry-bush/rule.ts
+++ b/src/commands/moulberry-bush/rule.ts
@@ -171,10 +171,7 @@ export default class RuleCommand extends BushCommand {
public async execSlash(
message: CommandInteraction,
- {
- rule,
- user
- }: { rule?: SlashCommandOption<number>; user?: SlashCommandOption<void> }
+ { rule, user }: { rule?: SlashCommandOption<number>; user?: SlashCommandOption<void> }
): Promise<void> {
const response = this.getResponse(message, rule?.value, user?.user);
if (Array.isArray(response)) {
diff --git a/src/commands/server-config/prefix.ts b/src/commands/server-config/prefix.ts
index 899ecc9..f02e693 100644
--- a/src/commands/server-config/prefix.ts
+++ b/src/commands/server-config/prefix.ts
@@ -16,8 +16,7 @@ export default class PrefixCommand extends BushCommand {
],
userPermissions: ['MANAGE_GUILD'],
description: {
- content:
- 'Set the prefix of the current server (resets to default if prefix is not given)',
+ content: 'Set the prefix of the current server (resets to default if prefix is not given)',
usage: 'prefix [prefix]',
examples: ['prefix', 'prefix +']
},
@@ -54,9 +53,7 @@ export default class PrefixCommand extends BushCommand {
if (prefix) {
await message.util.send(`Sucessfully set prefix to \`${prefix}\``);
} else {
- await message.util.send(
- `Sucessfully reset prefix to \`${this.client.config.prefix}\``
- );
+ await message.util.send(`Sucessfully reset prefix to \`${this.client.config.prefix}\``);
}
}
@@ -68,9 +65,7 @@ export default class PrefixCommand extends BushCommand {
if (prefix) {
await message.reply(`Sucessfully set prefix to \`${prefix.value}\``);
} else {
- await message.reply(
- `Sucessfully reset prefix to \`${this.client.config.prefix}\``
- );
+ await message.reply(`Sucessfully reset prefix to \`${this.client.config.prefix}\``);
}
}
}
diff --git a/src/lib/extensions/BushClient.ts b/src/lib/extensions/BushClient.ts
index 8a8ae91..99d0dd3 100644
--- a/src/lib/extensions/BushClient.ts
+++ b/src/lib/extensions/BushClient.ts
@@ -122,14 +122,10 @@ export class BushClient extends AkairoClient {
for (const loader of Object.keys(loaders)) {
try {
loaders[loader].loadAll();
- this.logger.log(
- chalk.green('Successfully loaded ' + chalk.cyan(loader) + '.')
- );
+ this.logger.log(chalk.green('Successfully loaded ' + chalk.cyan(loader) + '.'));
} catch (e) {
console.error(
- chalk.red(
- 'Unable to load loader ' + chalk.cyan(loader) + ' with error ' + e
- )
+ chalk.red('Unable to load loader ' + chalk.cyan(loader) + ' with error ' + e)
);
}
}
diff --git a/src/lib/extensions/Util.ts b/src/lib/extensions/Util.ts
index 7c1d4b2..7bedfc1 100644
--- a/src/lib/extensions/Util.ts
+++ b/src/lib/extensions/Util.ts
@@ -125,9 +125,7 @@ export class Util extends ClientUtil {
public async haste(content: string): Promise<string> {
for (const url of this.hasteURLs) {
try {
- const res: hastebinRes = await got
- .post(`${url}/documents`, { body: content })
- .json();
+ const res: hastebinRes = await got.post(`${url}/documents`, { body: content }).json();
return `${url}/${res.key}`;
} catch (e) {
// pass
@@ -220,10 +218,7 @@ export class Util extends ClientUtil {
/**
* A simple utility to create and embed with the needed style for the bot
*/
- public createEmbed(
- color?: string,
- author?: User | GuildMember
- ): MessageEmbed {
+ public createEmbed(color?: string, author?: User | GuildMember): MessageEmbed {
if (author instanceof GuildMember) {
author = author.user; // Convert to User if GuildMember
}
@@ -255,15 +250,12 @@ export class Util extends ClientUtil {
: await fetchedGuild.commands.fetch();
for (const [, registeredCommand] of registered) {
if (
- !this.client.commandHandler.modules.find(
- (cmd) => cmd.id == registeredCommand.name
- )?.execSlash ||
+ !this.client.commandHandler.modules.find((cmd) => cmd.id == registeredCommand.name)
+ ?.execSlash ||
force
) {
guild === undefined
- ? await this.client.application.commands.delete(
- registeredCommand.id
- )
+ ? await this.client.application.commands.delete(registeredCommand.id)
: await fetchedGuild.commands.delete(registeredCommand.id);
this.client.logger.verbose(
chalk`{red Deleted slash command ${registeredCommand.name}${
@@ -286,10 +278,7 @@ export class Util extends ClientUtil {
if (found?.id && !force) {
if (slashdata.description !== found.description) {
guild === undefined
- ? await this.client.application.commands.edit(
- found.id,
- slashdata
- )
+ ? await this.client.application.commands.edit(found.id, slashdata)
: fetchedGuild.commands.edit(found.id, slashdata);
this.client.logger.verbose(
chalk`{yellow Edited slash command ${BushCommand.id}${
@@ -312,9 +301,7 @@ export class Util extends ClientUtil {
return this.client.logger.log(
chalk.green(
- `Slash commands registered${
- guild !== undefined ? ` in guild ${fetchedGuild.name}` : ''
- }`
+ `Slash commands registered${guild !== undefined ? ` in guild ${fetchedGuild.name}` : ''}`
)
);
} catch (e) {
diff --git a/src/lib/models/Ban.ts b/src/lib/models/Ban.ts
index 3ce9c06..75e38ab 100644
--- a/src/lib/models/Ban.ts
+++ b/src/lib/models/Ban.ts
@@ -20,10 +20,7 @@ export interface BanModelCreationAttributes {
modlog: string;
}
-export class Ban
- extends BaseModel<BanModel, BanModelCreationAttributes>
- implements BanModel
-{
+export class Ban extends BaseModel<BanModel, BanModelCreationAttributes> implements BanModel {
/**
* The ID of this ban (no real use just for a primary key)
*/
diff --git a/src/lib/models/Modlog.ts b/src/lib/models/Modlog.ts
index 7efeeed..52a13b2 100644
--- a/src/lib/models/Modlog.ts
+++ b/src/lib/models/Modlog.ts
@@ -54,14 +54,7 @@ export class Modlog
defaultValue: uuidv4
},
type: {
- type: new DataTypes.ENUM(
- 'BAN',
- 'TEMPBAN',
- 'MUTE',
- 'TEMPMUTE',
- 'KICK',
- 'WARN'
- ),
+ type: new DataTypes.ENUM('BAN', 'TEMPBAN', 'MUTE', 'TEMPMUTE', 'KICK', 'WARN'),
allowNull: false
},
user: {
diff --git a/src/lib/utils/Logger.ts b/src/lib/utils/Logger.ts
index 604b45e..b0f7da5 100644
--- a/src/lib/utils/Logger.ts
+++ b/src/lib/utils/Logger.ts
@@ -15,9 +15,7 @@ export class Logger {
);
}
public getChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> {
- return this.client.channels.fetch(
- this.client.config.channels[channel]
- ) as Promise<TextChannel>;
+ return this.client.channels.fetch(this.client.config.channels[channel]) as Promise<TextChannel>;
}
public async log(message: string, sendChannel = false): Promise<void> {
console.log(chalk`{bgCyan LOG} ` + message);
diff --git a/src/listeners/client/syncSlashCommands.ts b/src/listeners/client/syncSlashCommands.ts
index 7835136..69b91bc 100644
--- a/src/listeners/client/syncSlashCommands.ts
+++ b/src/listeners/client/syncSlashCommands.ts
@@ -10,10 +10,7 @@ export default class SyncSlashCommandsListener extends BushListener {
async exec(): Promise<void> {
if (this.client.config.dev && this.client.config.devGuild) {
// Use guild slash commands for instant registration in dev
- await this.client.util.syncSlashCommands(
- false,
- this.client.config.devGuild
- );
+ await this.client.util.syncSlashCommands(false, this.client.config.devGuild);
} else {
// Use global in production
await this.client.util.syncSlashCommands();
diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts
index dee1319..a6a7e7e 100644
--- a/src/listeners/commands/commandBlocked.ts
+++ b/src/listeners/commands/commandBlocked.ts
@@ -10,11 +10,7 @@ export default class CommandBlockedListener extends BushListener {
});
}
- public async exec(
- message: Message,
- command: Command,
- reason: string
- ): Promise<void> {
+ public async exec(message: Message, command: Command, reason: string): Promise<void> {
switch (reason) {
case 'owner': {
await message.util.send(
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 518545a..c5d6a74 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -12,11 +12,7 @@ export default class CommandErrorListener extends BushListener {
event: 'error'
});
}
- async exec(
- error: Error,
- message: Message,
- command?: BushCommand
- ): Promise<void> {
+ async exec(error: Error, message: Message, command?: BushCommand): Promise<void> {
const errorNumber = Math.floor(Math.random() * 6969696969) + 69; // hehe funy numbers
const errorDevEmbed = this.client.util
.createEmbed(this.client.util.colors.error)
diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts
index a2b7bb7..32ccd90 100644
--- a/src/listeners/commands/slashCommandError.ts
+++ b/src/listeners/commands/slashCommandError.ts
@@ -12,11 +12,7 @@ export default class SlashCommandErrorListener extends BushListener {
event: 'slashError'
});
}
- async exec(
- error: Error,
- message: CommandInteraction,
- command: BushCommand
- ): Promise<void> {
+ async exec(error: Error, message: CommandInteraction, command: BushCommand): Promise<void> {
const errorNumber = Math.floor(Math.random() * 6969696969) + 69; // hehe funy numbers
const errorDevEmbed = this.client.util
.createEmbed(this.client.util.colors.error)
diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts
index 3b23f36..c9d5522 100644
--- a/src/listeners/message/level.ts
+++ b/src/listeners/message/level.ts
@@ -16,8 +16,7 @@ export default class LevelListener extends BushListener {
if (message.author.bot) return;
if (message.util?.parsed?.command) return;
if (this.levelCooldowns.has(message.author.id)) return;
- if (!this.client.config.dev && message.guild.id != '516977525906341928')
- return;
+ if (!this.client.config.dev && message.guild.id != '516977525906341928') return;
if (this.blacklistedChannels.includes(message.channel.id)) return;
if (!['DEFAULT', 'REPLY'].includes(message.type)) return; //checks for join messages, slash commands, booster messages etc
const [user] = await Level.findOrBuild({
diff --git a/src/tasks/unban.ts b/src/tasks/unban.ts
index 6b9d82e..564a2a3 100644
--- a/src/tasks/unban.ts
+++ b/src/tasks/unban.ts
@@ -23,9 +23,7 @@ export default class UnbanTask extends BushTask {
]
}
});
- this.client.logger.verbose(
- chalk.cyan(`Queried bans, found ${rows.length} expired bans.`)
- );
+ this.client.logger.verbose(chalk.cyan(`Queried bans, found ${rows.length} expired bans.`));
for (const row of rows) {
const guild = this.client.guilds.cache.get(row.guild);
if (!guild) {
@@ -33,10 +31,7 @@ export default class UnbanTask extends BushTask {
continue;
}
try {
- await guild.members.unban(
- row.user,
- `Unbanning user because tempban expired`
- );
+ await guild.members.unban(row.user, `Unbanning user because tempban expired`);
} catch (e) {
if (e instanceof DiscordAPIError) {
// Member not banned, ignore