first commit
This commit is contained in:
commit
f680dd869b
6 changed files with 166 additions and 0 deletions
18
commands/admin.cs
Normal file
18
commands/admin.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
public class HasAdminRole : CheckBaseAttribute
|
||||
{
|
||||
public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help)
|
||||
{
|
||||
bool hasAdminRole = ctx.Member?.Roles.Any(role => role.Name == "Admin") ?? false;
|
||||
if (!hasAdminRole)
|
||||
{
|
||||
await ctx.RespondAsync("Csicskáknak kuss van !");
|
||||
}
|
||||
return (hasAdminRole);
|
||||
}
|
||||
}
|
||||
|
||||
19
commands/hello.cs
Normal file
19
commands/hello.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Commands
|
||||
{
|
||||
public class Hello : BaseCommandModule
|
||||
{
|
||||
[Command("hello")]
|
||||
[Description("Beköszönés. Hello World")]
|
||||
[HasAdminRole]
|
||||
public async Task HelloCommand(CommandContext ctx)
|
||||
{
|
||||
await ctx.RespondAsync($"Szia! T3kerg0 vagyok!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue