Skip to content

Commit

Permalink
Add saychannel
Browse files Browse the repository at this point in the history
  • Loading branch information
Blocksnmore committed May 2, 2024
1 parent eba0c64 commit 5d94ba5
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions commands/dev/saychannel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Command, CommandContext, Embed, GuildTextChannel } from "harmony";

export default class SayChannel extends Command {
name = "saychannel";
aliases = ["echochannel"];
description = "Make the bot say something";
category = "dev";
usage = "saychannel <channelid> <message>";
ownerOnly = true;
async execute(ctx: CommandContext) {
const [channelId, ...message] = ctx.argString.split(" ");
if (channelId == "" || message.length == 0) {
await ctx.message.reply(undefined, {
embeds: [new Embed({
author: {
name: "Bidome bot",
icon_url: ctx.message.client.user!.avatarURL(),
},
title: "Bidome say",
description: `You need to provide a message`,
}).setColor("red")],
});
} else {
const channel = await ctx.client.channels.resolve(channelId) as GuildTextChannel;

if (channel === undefined) {
await ctx.message.reply(undefined, {
embeds: [new Embed({
author: {
name: "Bidome bot",
icon_url: ctx.message.client.user!.avatarURL(),
},
title: "Bidome say",
description: `Unable to find the channel you provided`,
}).setColor("red")],
});
}

await channel.send(ctx.argString);
}
}
}

0 comments on commit 5d94ba5

Please sign in to comment.