Skip to content

Commit

Permalink
feat(command): add role command
Browse files Browse the repository at this point in the history
  • Loading branch information
tinarskii committed Nov 11, 2022
1 parent b61a958 commit 549a963
Show file tree
Hide file tree
Showing 16 changed files with 260 additions and 31 deletions.
3 changes: 2 additions & 1 deletion src/commands/Age-Restricted Category/danbooru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export class DanbooruCommand {
.setURL(`https://danbooru.donmai.us/posts/${data[0].id}`)
.setFooter({
text: `rating: ${this.rating[data[0].rating as keyof typeof this.rating]} | score: ${data[0].score}`,
}),
})
.setTimestamp()
],
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/commands/Age-Restricted Category/gelbooru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export class GelbooruCommand {
.setColor(Colors.Fuchsia)
.setImage(data.post[0].file_url)
.setFooter({ text: `rating: ${data.post[0].rating} | score: ${data.post[0].score}` })
.setURL(`https://gelbooru.com/index.php?page=post&s=view&id=${data.post[0].id}`),
.setURL(`https://gelbooru.com/index.php?page=post&s=view&id=${data.post[0].id}`)
.setTimestamp()
],
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/commands/Age-Restricted Category/rule34.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export class Rule34Command {
.setColor(Colors.Fuchsia)
.setImage(image.file_url)
.setFooter({ text: `rating: ${image.rating} | score: ${image.score}` })
.setURL(`https://rule34.xxx/index.php?page=post&s=view&id=${image.id}`),
.setURL(`https://rule34.xxx/index.php?page=post&s=view&id=${image.id}`)
.setTimestamp()
],
});
}
Expand Down
26 changes: 24 additions & 2 deletions src/commands/Fun Category/meme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@ export class MemeCommand {
await interaction.deferUpdate();
const data = await MemeCommand.fetchMemes();
await interaction.editReply({
embeds: [new EmbedBuilder().setTitle(data.title).setImage(data.url).setURL(data.postLink).setColor(Colors.Green)],
embeds: [
new EmbedBuilder()
.setTitle(data.title)
.setImage(data.url)
.setURL(data.postLink)
.setColor(Colors.Green)
.setFooter({
text:`Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL()
})
.setTimestamp(),
],
components: [MemeCommand.buttonRow],
});
}
Expand All @@ -30,7 +41,18 @@ export class MemeCommand {
async meme(interaction: CommandInteraction): Promise<void> {
const data = await MemeCommand.fetchMemes();
await interaction.reply({
embeds: [new EmbedBuilder().setTitle(data.title).setImage(data.url).setURL(data.postLink).setColor(Colors.Green)],
embeds: [
new EmbedBuilder()
.setTitle(data.title)
.setImage(data.url)
.setURL(data.postLink)
.setColor(Colors.Green)
.setFooter({
text:`Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL()
})
.setTimestamp(),
],
components: [MemeCommand.buttonRow],
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/commands/Fun Category/xkcd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export class XkcdCommand {
.setTitle(`#${data.num} - ${data.title}`)
.setImage(data.img)
.setDescription(data.alt)
.setFooter({ text: `${data.year} - ${data.month}/${data.day}`, iconURL: interaction.user.avatarURL()! }),
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand Down
7 changes: 6 additions & 1 deletion src/commands/Game Category/8ball.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export class Magic8Ball {
.setDescription(
`**Question:** ${question}\n**Answer:** ${answers[Math.floor(Math.random() * answers.length)]}`,
)
.setColor(Colors.Blue),
.setColor(Colors.Blue)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand Down
7 changes: 6 additions & 1 deletion src/commands/Game Category/coin-flip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export class CoinFlipCommand {
{ name: "Generated Number", value: String(genNum) },
{ name: "Seed", value: String(seed) },
])
.setColor([0, 255, 0]),
.setColor([0, 255, 0])
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand Down
14 changes: 12 additions & 2 deletions src/commands/Miscellaneous Category/avatar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionType, CommandInteraction, User } from "discord.js";
import { ApplicationCommandOptionType, Colors, CommandInteraction, EmbedBuilder, User } from "discord.js";
import { Discord, Slash, SlashOption } from "discordx";
import { Category } from "@discordx/utilities";

Expand All @@ -17,7 +17,17 @@ export class AvatarCommand {
interaction: CommandInteraction,
): Promise<void> {
await interaction.reply({
content: user.displayAvatarURL({ size: 4096 }),
embeds: [
new EmbedBuilder()
.setTitle(`🖼 Avatar of ${user.username}`)
.setImage(user.avatarURL()!)
.setColor(Colors.Green)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
ephemeral: true,
});
}
Expand Down
10 changes: 6 additions & 4 deletions src/commands/Miscellaneous Category/bot-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export class BotStatsCommand {
.setColor([0, 153, 255])
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.avatarURL()!,
}),
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand All @@ -60,8 +61,9 @@ export class BotStatsCommand {
.setThumbnail(bot.user!.displayAvatarURL())
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.avatarURL()!,
}),
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand Down
14 changes: 12 additions & 2 deletions src/commands/Miscellaneous Category/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export class InfoCommand {
])
.setThumbnail(member.user.avatarURL())
.setColor(Colors.Blurple)
.setImage(member.user.banner ?? "https://i.redd.it/pyeuy7iyfw961.png"),
.setImage(member.user.banner ?? "https://i.redd.it/pyeuy7iyfw961.png")
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand All @@ -67,7 +72,12 @@ export class InfoCommand {
{ name: "✅ isVerified", value: server.verified.toString(), inline: true },
{ name: "🚨 mfaLevel", value: server.mfaLevel.toString(), inline: true },
])
.setThumbnail(<string>server.iconURL()),
.setThumbnail(<string>server.iconURL())
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
}
Expand Down
26 changes: 22 additions & 4 deletions src/commands/Moderation Category/ban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export class BanCommand {
new EmbedBuilder()
.setTitle("Something went wrong!")
.setDescription("The user may not be bannable or something else went *seriously* wrong")
.setColor(Colors.Red),
.setColor(Colors.Red)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
components: [],
});
Expand All @@ -43,7 +48,12 @@ export class BanCommand {
new EmbedBuilder()
.setTitle("User banned")
.setDescription(`Successfully banned <@${this.selectedUser?.id}>\nReason: \`${this.reason}\``)
.setColor(Colors.Green),
.setColor(Colors.Green)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
components: [],
});
Expand Down Expand Up @@ -77,7 +87,12 @@ export class BanCommand {
new EmbedBuilder()
.setTitle("User not bannable")
.setDescription("The user may have a higher role than me or I may not have the ban permission")
.setColor(Colors.Red),
.setColor(Colors.Red)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
return;
Expand All @@ -90,7 +105,10 @@ export class BanCommand {
.setDescription(`You are about to ban <@${user.id}>`)
.setColor(Colors.Red)
.setThumbnail(user.displayAvatarURL())
.setFooter({ iconURL: interaction.user.displayAvatarURL(), text: `Requested by ${interaction.user.tag}` })
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
components: [BanCommand.buttonRow],
Expand Down
9 changes: 5 additions & 4 deletions src/commands/Moderation Category/delete.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Discord, Guard, Slash, SlashOption } from "discordx";
import { PermissionGuard } from "@discordx/utilities";
import { Category, PermissionGuard } from "@discordx/utilities";
import { ApplicationCommandOptionType } from "discord-api-types/v10";
import { Colors, CommandInteraction, EmbedBuilder, TextChannel } from "discord.js";

@Discord()
@Category("Moderation")
export class DeleteMessageCommand {
@Slash({ name: "delete", description: "Delete message within 2 weeks old" })
@Guard(PermissionGuard(["ManageMessages"]))
Expand All @@ -15,7 +16,7 @@ export class DeleteMessageCommand {
type: ApplicationCommandOptionType.Number,
})
amount: number,
interaction: CommandInteraction
interaction: CommandInteraction,
): Promise<void> {
try {
await (interaction.channel as TextChannel)?.bulkDelete(amount);
Expand All @@ -26,7 +27,7 @@ export class DeleteMessageCommand {
.setTitle("Something went wrong!")
.setDescription("I don't have permission to delete message or something else went *seriously* wrong")
.setColor(Colors.Red),
]
],
});
}

Expand All @@ -39,4 +40,4 @@ export class DeleteMessageCommand {
],
});
}
}
}
19 changes: 16 additions & 3 deletions src/commands/Moderation Category/kick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export class KickCommand {
new EmbedBuilder()
.setTitle("User kicked")
.setDescription(`Successfully kicked <@${this.selectedUser?.id}>\nReason: \`${this.reason}\``)
.setColor(Colors.Green),
.setColor(Colors.Green)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
components: [],
});
Expand Down Expand Up @@ -78,7 +83,12 @@ export class KickCommand {
new EmbedBuilder()
.setTitle("User not kickable")
.setDescription("The user may have a higher role than me or I may not have the ban permission")
.setColor(Colors.Red),
.setColor(Colors.Red)
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
});
return;
Expand All @@ -91,7 +101,10 @@ export class KickCommand {
.setDescription(`You are about to kick <@${user.id}>`)
.setColor(Colors.Red)
.setThumbnail(user.displayAvatarURL())
.setFooter({ iconURL: interaction.user.displayAvatarURL(), text: `Requested by ${interaction.user.tag}` })
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: interaction.user.displayAvatarURL(),
})
.setTimestamp(),
],
components: [KickCommand.buttonRow],
Expand Down
Loading

0 comments on commit 549a963

Please sign in to comment.