hello and send messages
This commit is contained in:
parent
61b0fdf733
commit
4187f4269a
4 changed files with 89 additions and 0 deletions
43
Commands/SendModule.cs
Normal file
43
Commands/SendModule.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace KBot;
|
||||
|
||||
public class SendModule : BaseCommandModule
|
||||
{
|
||||
[
|
||||
Command("send"),
|
||||
Description("Lets you send a message to a channel, user, or in reply to a message"),
|
||||
RequireRoles(RoleCheckMode.All, "Admin")
|
||||
]
|
||||
public async Task SendChannelCommand(
|
||||
CommandContext ctx,
|
||||
[Description("The channel the message will be sent to")] DiscordChannel channel,
|
||||
[RemainingText, Description("The message sent")] string content
|
||||
)
|
||||
{
|
||||
await ctx.Client.SendMessageAsync(channel, content);
|
||||
}
|
||||
|
||||
[Command("send"), RequireRoles(RoleCheckMode.All, "Admin")]
|
||||
public async Task SendDmCommand(
|
||||
CommandContext ctx,
|
||||
[Description("The member you want to send the message to")] DiscordMember member,
|
||||
[RemainingText, Description("The message sent")] string content
|
||||
)
|
||||
{
|
||||
var channel = await member.CreateDmChannelAsync();
|
||||
await ctx.Client.SendMessageAsync(channel, content);
|
||||
}
|
||||
|
||||
[Command("send"), RequireRoles(RoleCheckMode.All, "Admin")]
|
||||
public async Task SendReplyCommand(
|
||||
CommandContext ctx,
|
||||
[Description("The message you want to reply to")] DiscordMessage message,
|
||||
[RemainingText, Description("The message sent")] string content
|
||||
)
|
||||
{
|
||||
await message.RespondAsync(content);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue