using DSharpPlus.CommandsNext;
using DSharpPlus.EventArgs;
using Microsoft.Extensions.Logging;
using DSharpPlus.CommandsNext.Attributes;
using System.Collections.Generic;
using System.Threading.Tasks;
static void Main(string[] args)
bot.RunAsync().GetAwaiter().GetResult();
public class PotatoCommands : BaseCommandModule
List<string> potatoFacts = new List<string>();
[Description("Sends random potato fact")]
public async Task potatoFact(CommandContext ctx)
potatoFacts.AddRange(new string[]{
"There are many, MANY potatoes you have not heard of",
"When you buy them, potatoes are still alive",
"A sweet potato is not actually a potato",
"Potatoes were first grown in South America",
"Potatoes were the first vegetable grown in space",
"Potatoes can turn green",
"Potatoes last a long time if you treat them right",
"Potato chips, as we know them, were invented by mistake",
"Potatoes are not just for eating"
Random rand = new Random();
await ctx.Channel.SendMessageAsync("```"+ potatoFacts[rand.Next(0,potatoFacts.Count)] + "```").ConfigureAwait(false);
[Description("sends hentai")]
public async Task Hentai(CommandContext ctx)
Random rand = new Random();
int codefirst = rand.Next(1, 4);
codeSec = rand.Next(0, 5);
codeSec = rand.Next(0, 10);
string code = "https://nhentai.to/g/" + codefirst.ToString() + codeSec.ToString() + rand.Next(0, 10).ToString() + rand.Next(0, 10).ToString() + rand.Next(0, 10).ToString() + rand.Next(0, 10).ToString();
await ctx.Channel.SendMessageAsync(code).ConfigureAwait(false);
public DiscordClient Client { get; private set; }
public CommandsNextExtension commands { get; private set; }
public async Task RunAsync()
var config = new DiscordConfiguration
Token = "ODM5MTY4Nzg1MzgxODUxMTg2.YJFu1Q.05zgN9lykcRg2_0LKSdKaUiJTHo",
TokenType = TokenType.Bot,
MinimumLogLevel = LogLevel.Debug,
Client = new DiscordClient(config);
Client.Ready += OnClientReady;
var commandsConfig = new CommandsNextConfiguration
StringPrefixes = new string[] { "?" },
EnableMentionPrefix = true,
IgnoreExtraArguments = true,
commands = Client.UseCommandsNext(commandsConfig);
commands.RegisterCommands<PotatoCommands>();
await Client.ConnectAsync();
private Task OnClientReady(object sender,ReadyEventArgs e)
return Task.CompletedTask;