added sendmsg command
This commit is contained in:
parent
e97a4e7a66
commit
29de185cba
4 changed files with 94 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ using DSharpPlus.CommandsNext;
|
|||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Commands
|
||||
namespace T3k3rg0.Commands
|
||||
{
|
||||
public class Hello : BaseCommandModule
|
||||
{
|
||||
|
|
|
|||
28
commands/send.cs
Normal file
28
commands/send.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace T3k3rg0.Commands
|
||||
{
|
||||
public class Send : BaseCommandModule
|
||||
{
|
||||
[Command("sendmsg")]
|
||||
[Description("Üzenetet küld ! sendmsg <csatorna> <üzenet>")]
|
||||
[HasAdminRole]
|
||||
public async Task SendAsync(CommandContext ctx, string channelParam, [RemainingText] string message)
|
||||
{
|
||||
// Használjuk a ChannelHelper-t a csatorna kezeléséhez
|
||||
var channel = await IdExtractor.GetChannelAsync(ctx, channelParam);
|
||||
|
||||
if (channel == null)
|
||||
{
|
||||
// Ha a csatorna érvénytelen, a ChannelHelper már válaszolt, itt nem kell további kód.
|
||||
return;
|
||||
}
|
||||
|
||||
// Üzenet küldése a megtalált csatornára
|
||||
await channel.SendMessageAsync(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue