using DSharpPlus.CommandsNext;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
public static void Main()
bot.RunAsync().GetAwaiter().GetResult();
public DiscordClient Client { get; private set; }
public CommandsNextExtension Commands { get; private set; }
public async Task RunAsync()
var config = new DiscordConfiguration
Token = "NzQzMjM2NDU1MjE1NjYxMjE3.XzRu4w.Q7--Z3de9Hc9B4406tHyMM05TrY",
TokenType = TokenType.Bot,
MinimumLogLevel = LogLevel.Debug
Client = new DiscordClient(config);
Client.Ready += OnClientReady;
var commandConfig = new CommandsNextConfiguration
StringPrefixes = new string[] { "." },
EnableMentionPrefix = false,
Commands = Client.UseCommandsNext(commandConfig);
Voice = Client.UseVoiceNext();
Commands.CommandErrored += Commands_CommandErrored;
Client.Ready += OnClientReady;
await Client.ConnectAsync();
private Task Commands_CommandErrored(CommandsNextExtension sender, CommandErrorEventArgs e)
if(e.Context.Message.Content.Contains("."))
return Task.CompletedTask;
DiscordEmbed embed = new DiscordEmbedBuilder
Title = $"Sorry, {e.Context.Message.Content} Isn't A Command",
Description = "Please do .help for help",
return e.Context.Channel.SendMessageAsync(embed: embed);
private Task OnClientReady(DiscordClient sender, DSharpPlus.EventArgs.ReadyEventArgs e)
return Task.CompletedTask;
public class TestCommands : BaseCommandModule
public async Task TestCommand(CommandContext ctx)
await ctx.Channel.SendMessageAsync("HEHE YES! yes");