Skip to content

Commit

Permalink
status command (ripped from submission bot)
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Oct 18, 2023
1 parent d382105 commit 6111524
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
67 changes: 67 additions & 0 deletions src/commands/bot/status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import {
ActivityType,
SlashCommandBuilder,
PermissionFlagsBits,
PresenceStatusData,
} from "discord.js";
import { EmbedBuilder, ChatInputCommandInteraction } from "@client";
import { SlashCommand } from "@interfaces";

export const command: SlashCommand = {
data: new SlashCommandBuilder()
.setName("status")
.setDescription("Changes the bot's status.")
.addStringOption((option) =>
option
.setName("activity")
.setDescription("What activity the bot is doing (e.g. playing, streaming)")
.addChoices(
...Object.values(ActivityType)
.filter((x) => typeof x == "string")
.map((i: string) => {
return { name: i, value: i };
}),
)
.setRequired(true),
)
.addStringOption((option) =>
option
.setName("presence")
.setDescription("What presence the bot should have")
.addChoices(
{ name: "Online", value: "online" },
{ name: "Idle", value: "idle" },
{ name: "Do not Disturb", value: "dnd" },
)
.setRequired(true),
)
.addStringOption((option) =>
option
.setName("message")
.setDescription("Message to show after the bot activity")
.setRequired(true),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction: ChatInputCommandInteraction) {
if (!interaction.hasPermission("dev")) return;

const activity = interaction.options.getString("activity", true);
const presence = interaction.options.getString("presence", true);
const message = interaction.options.getString("message", true);

interaction.client.user.setPresence({
activities: [
{
name: message,
type: ActivityType[activity],
},
],
status: presence as PresenceStatusData,
});

await interaction.reply({
embeds: [new EmbedBuilder().setTitle("Bot status successfully changed!")],
ephemeral: true,
});
},
};
4 changes: 1 addition & 3 deletions src/commands/images/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ export const command: SlashCommand = {
embeds: [
new EmbedBuilder()
.setTitle(interaction.strings().command.animate.invalid_text.title)
.setDescription(
interaction.strings().command.animate.invalid_text.description,
)
.setDescription(interaction.strings().command.animate.invalid_text.description)
.setColor(colors.red),
],
ephemeral: true,
Expand Down

0 comments on commit 6111524

Please sign in to comment.