aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moulberry-bush
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r--src/commands/moulberry-bush/capePerms.ts4
-rw-r--r--src/commands/moulberry-bush/level.ts7
-rw-r--r--src/commands/moulberry-bush/rule.ts25
3 files changed, 18 insertions, 18 deletions
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts
index 539ddf6..a564fc3 100644
--- a/src/commands/moulberry-bush/capePerms.ts
+++ b/src/commands/moulberry-bush/capePerms.ts
@@ -1,7 +1,7 @@
import { Constants } from 'discord-akairo';
import { MessageEmbed } from 'discord.js';
import got from 'got';
-import { BushCommand, BushMessage } from '../../lib';
+import { BushCommand, BushMessage, BushSlashMessage } from '../../lib';
export default class CapePermissionsCommand extends BushCommand {
private nameMap = {
@@ -67,7 +67,7 @@ export default class CapePermissionsCommand extends BushCommand {
});
}
- public async exec(message: BushMessage, args: { ign: string }): Promise<unknown> {
+ public async exec(message: BushMessage | BushSlashMessage, args: { ign: string }): Promise<unknown> {
interface Capeperms {
success: boolean;
perms: User[];
diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts
index 90a4b7f..5dcafe5 100644
--- a/src/commands/moulberry-bush/level.ts
+++ b/src/commands/moulberry-bush/level.ts
@@ -1,5 +1,4 @@
-import { Message, User } from 'discord.js';
-import { BushCommand, BushSlashMessage, Level } from '../../lib';
+import { BushCommand, BushMessage, BushSlashMessage, BushUser, Level } from '../../lib';
/*
import canvas from 'canvas';
import { MessageAttachment } from 'discord.js';
@@ -128,7 +127,7 @@ export default class LevelCommand extends BushCommand {
return image.toBuffer();
} */
- private async getResponse(user: User): Promise<string> {
+ private async getResponse(user: BushUser): Promise<string> {
const userLevelRow = await Level.findByPk(user.id);
if (userLevelRow) {
return `${user ? `${user.tag}'s` : 'Your'} level is ${userLevelRow.level} (${userLevelRow.xp} XP)`;
@@ -137,7 +136,7 @@ export default class LevelCommand extends BushCommand {
}
}
- async exec(message: Message | BushSlashMessage, { user }: { user?: User }): Promise<void> {
+ async exec(message: BushMessage | BushSlashMessage, { user }: { user?: BushUser }): Promise<void> {
// await message.reply(
// new MessageAttachment(
// await this.getImage(user || message.author),
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts
index 516aadf..f8d312f 100644
--- a/src/commands/moulberry-bush/rule.ts
+++ b/src/commands/moulberry-bush/rule.ts
@@ -1,6 +1,6 @@
import { Argument, Constants } from 'discord-akairo';
import { MessageEmbed, User } from 'discord.js';
-import { AllowedMentions, BushCommand, BushMessage } from '../../lib';
+import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '../../lib';
const rules = [
{
@@ -106,7 +106,10 @@ export default class RuleCommand extends BushCommand {
});
}
- public async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> {
+ public async exec(
+ message: BushMessage | BushSlashMessage,
+ { rule, user }: { rule: undefined | number; user: User }
+ ): Promise<unknown> {
const rulesEmbed = new MessageEmbed()
.setColor('#ef3929')
.setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }))
@@ -130,21 +133,19 @@ export default class RuleCommand extends BushCommand {
return;
async function respond(): Promise<unknown> {
if (!user) {
- return (
- // If the original message was a reply -> imitate it
- message.reference?.messageID && !message.util.isSlash
- ? await message.channel.messages.fetch(message.reference.messageID).then(async (message) => {
- await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() });
- })
- : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() })
- );
+ // If the original message was a reply -> imitate it
+ (message as BushMessage).reference?.messageID && !message.util.isSlash
+ ? await message.channel.messages.fetch((message as BushMessage).reference.messageID).then(async (message) => {
+ await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() });
+ })
+ : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() });
} else {
- return message.reference?.messageID && !message.util.isSlash
+ return (message as BushMessage).reference?.messageID && !message.util.isSlash
? await message.util.send({
content: `<@!${user.id}>`,
embeds: [rulesEmbed],
allowedMentions: AllowedMentions.users(),
- reply: { messageReference: message.reference.messageID }
+ reply: { messageReference: (message as BushMessage).reference.messageID }
})
: await message.util.send({
content: `<@!${user.id}>`,