-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eba0c64
commit 5d94ba5
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |