43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
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);
|
|
}
|
|
}
|