Add greetings in 299 languages
This commit is contained in:
parent
8018d5e750
commit
12199f4ad4
3 changed files with 1660 additions and 0 deletions
10
Geekbot.net/Commands/Randomness/Greetings/GreetingDto.cs
Normal file
10
Geekbot.net/Commands/Randomness/Greetings/GreetingDto.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Geekbot.net.Commands.Randomness.Greetings
|
||||||
|
{
|
||||||
|
public class GreetingDto
|
||||||
|
{
|
||||||
|
public string Text { get; set; }
|
||||||
|
public string Language { get; set; }
|
||||||
|
public string Dialect { get; set; } = null;
|
||||||
|
public string Romanization { get; set; } = null;
|
||||||
|
}
|
||||||
|
}
|
1600
Geekbot.net/Commands/Randomness/Greetings/GreetingProvider.cs
Normal file
1600
Geekbot.net/Commands/Randomness/Greetings/GreetingProvider.cs
Normal file
File diff suppressed because it is too large
Load diff
50
Geekbot.net/Commands/Randomness/Greetings/Greetings.cs
Normal file
50
Geekbot.net/Commands/Randomness/Greetings/Greetings.cs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Discord;
|
||||||
|
using Discord.Commands;
|
||||||
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
|
|
||||||
|
namespace Geekbot.net.Commands.Randomness.Greetings
|
||||||
|
{
|
||||||
|
public class Greetings : ModuleBase
|
||||||
|
{
|
||||||
|
private readonly IErrorHandler _errorHandler;
|
||||||
|
|
||||||
|
public Greetings(IErrorHandler errorHandler)
|
||||||
|
{
|
||||||
|
_errorHandler = errorHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("hello", RunMode = RunMode.Async)]
|
||||||
|
[Alias("greeting")]
|
||||||
|
[Summary("Say hello to the bot and get a reply in a random language")]
|
||||||
|
public async Task GetGreeting()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var greeting = GreetingProvider.Greetings[new Random().Next(GreetingProvider.GreetingCount - 1)];
|
||||||
|
|
||||||
|
var eb = new EmbedBuilder();
|
||||||
|
eb.Title = greeting.Text;
|
||||||
|
eb.AddInlineField("Language", greeting.Language);
|
||||||
|
|
||||||
|
if (greeting.Dialect != null)
|
||||||
|
{
|
||||||
|
eb.AddInlineField("Dialect", greeting.Dialect);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (greeting.Romanization != null)
|
||||||
|
{
|
||||||
|
eb.AddInlineField("Romanization", greeting.Romanization);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ReplyAsync(string.Empty, false, eb.Build());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _errorHandler.HandleCommandException(e, Context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue