start converting benbot commands
This commit is contained in:
parent
5afef72570
commit
2420ae15c1
|
@ -0,0 +1,16 @@
|
|||
using Discord.Commands;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace dotbot.Commands
|
||||
{
|
||||
public class AsciiArt : ModuleBase<SocketCommandContext>
|
||||
{
|
||||
[Command("ascii")]
|
||||
[Summary("creates ascii word art")]
|
||||
public async Task CreateAsciiArt([Remainder] [Summary("text to convert")] string ArtString)
|
||||
{
|
||||
await ReplyAsync($"```\n{(new WenceyWang.FIGlet.AsciiArt(ArtString)).ToString()}\n```");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ namespace dotbot.Commands
|
|||
[Command("help")]
|
||||
public async Task HelpAsync()
|
||||
{
|
||||
string prefix = _config["prefix"];
|
||||
var builder = new EmbedBuilder()
|
||||
{
|
||||
Color = new Color(114, 137, 218),
|
||||
|
@ -34,7 +33,7 @@ namespace dotbot.Commands
|
|||
{
|
||||
var result = await cmd.CheckPreconditionsAsync(Context);
|
||||
if (result.IsSuccess)
|
||||
description += $"{prefix}{cmd.Aliases.First()}\n";
|
||||
description += $"{_config["prefix"]}{cmd.Aliases.First()}\n";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(description))
|
||||
|
@ -62,7 +61,6 @@ namespace dotbot.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
string prefix = _config["prefix"];
|
||||
var builder = new EmbedBuilder()
|
||||
{
|
||||
Color = new Color(114, 137, 218),
|
||||
|
@ -82,7 +80,7 @@ namespace dotbot.Commands
|
|||
});
|
||||
}
|
||||
|
||||
await ReplyAsync("", false, builder.Build());
|
||||
await ReplyAsync("", embed: builder.Build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
using Discord.Commands;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace dotbot.Commands
|
||||
{
|
||||
public class Misc : ModuleBase<SocketCommandContext>
|
||||
{
|
||||
private readonly Random _rand;
|
||||
|
||||
public Misc(Random rand)
|
||||
{
|
||||
_rand = rand;
|
||||
}
|
||||
|
||||
[Command("roll")]
|
||||
[Summary("rolls an n-sided die (defaults to 6-sided")]
|
||||
public async Task RollDie([Summary("[number of sides]")] int sides = 6)
|
||||
{
|
||||
await Context.Message.DeleteAsync();
|
||||
await ReplyAsync($"{Context.User.Mention}, you rolled a {_rand.Next(1, sides)}. (d{sides})");
|
||||
}
|
||||
|
||||
[Command("rand")]
|
||||
[Summary("gets a random number")]
|
||||
public async Task RandomInt([Summary("max number")] int max = 100)
|
||||
{
|
||||
await Context.Message.DeleteAsync();
|
||||
await ReplyAsync($"{Context.User.Mention}, your random number (between 1 and {max}) is {_rand.Next(1, max)}");
|
||||
}
|
||||
|
||||
[Command("rand")]
|
||||
[Summary("gets a random number between min and max")]
|
||||
public async Task RandomInt([Summary("min number")] int min, [Summary("max number")] int max)
|
||||
{
|
||||
await Context.Message.DeleteAsync();
|
||||
await ReplyAsync($"{Context.User.Mention}, your random number (between {min} and {max}) is {_rand.Next(min, max)}");
|
||||
}
|
||||
|
||||
[Command("8ball")]
|
||||
[Summary("ask the mighty 8-ball to determine your fortunes")]
|
||||
public async Task Ask8Ball([Remainder] [Summary("your question for the magic 8ball")] string question)
|
||||
{
|
||||
var responses = new List<string>
|
||||
{
|
||||
"It is certain",
|
||||
"It is decidedly so",
|
||||
"Without a doubt",
|
||||
"Yes definitely",
|
||||
"You may rely on it",
|
||||
"As I see it, yes",
|
||||
"Most likely",
|
||||
"Outlook good",
|
||||
"Yes",
|
||||
"Signs point to yes",
|
||||
"Reply hazy try again",
|
||||
"Ask again later",
|
||||
"Better not tell you now",
|
||||
"Cannot predict now",
|
||||
"Concentrate and ask again",
|
||||
"Don't count on it",
|
||||
"My reply is no",
|
||||
"My sources say no",
|
||||
"Outlook not so good",
|
||||
"Very doubtful",
|
||||
};
|
||||
await Context.Message.DeleteAsync();
|
||||
await ReplyAsync($"{Context.User.Mention} asked: *{question}*\n\n**{responses.OrderBy(q => Guid.NewGuid()).First()}**");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace dotbot.Commands
|
||||
|
@ -11,7 +9,7 @@ namespace dotbot.Commands
|
|||
{
|
||||
[Command("hi")]
|
||||
[Summary("says hi")]
|
||||
public async Task SayHi([Remainder] [Summary("the stuff to say")] string echo = "")
|
||||
public async Task SayHi([Remainder] [Summary("the stuff to say")] string echo = ";hi")
|
||||
{
|
||||
await ReplyAsync($"hi friend! you said: \"{echo}\"");
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace dotbot
|
|||
private DiscordSocketClient _client;
|
||||
private IConfigurationRoot _config;
|
||||
private IServiceProvider _services;
|
||||
private Random _rand;
|
||||
|
||||
public static void Main(string[] args)
|
||||
=> new Program().StartAsync().GetAwaiter().GetResult();
|
||||
|
@ -36,11 +37,13 @@ namespace dotbot
|
|||
|
||||
_client.Log += Log;
|
||||
|
||||
_rand = new Random();
|
||||
|
||||
_services = new ServiceCollection()
|
||||
.AddSingleton(_client)
|
||||
.AddSingleton(_commands)
|
||||
.AddSingleton(_config)
|
||||
.AddSingleton<Random>()
|
||||
.AddSingleton(_rand)
|
||||
.BuildServiceProvider();
|
||||
|
||||
// install all commands from the assembly
|
||||
|
|
Loading…
Reference in New Issue