Remove the !hello/greeting command, the api is no longer available
This commit is contained in:
parent
15e1d10839
commit
245e88726a
3 changed files with 0 additions and 92 deletions
|
@ -1,22 +0,0 @@
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Geekbot.Bot.Commands.Randomness.Greetings
|
|
||||||
{
|
|
||||||
public class GreetingBaseDto
|
|
||||||
{
|
|
||||||
[JsonPropertyName("language")]
|
|
||||||
public string Language { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("languageNative")]
|
|
||||||
public string LanguageNative { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("languageCode")]
|
|
||||||
public string LanguageCode { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("script")]
|
|
||||||
public string Script { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("primary")]
|
|
||||||
public GreetingDto Primary { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Geekbot.Bot.Commands.Randomness.Greetings
|
|
||||||
{
|
|
||||||
public class GreetingDto
|
|
||||||
{
|
|
||||||
[JsonPropertyName("text")]
|
|
||||||
public string Text { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("dialect")]
|
|
||||||
public string Dialect { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("romanization")]
|
|
||||||
public string Romanization { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("use")]
|
|
||||||
public string[] Use { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Discord;
|
|
||||||
using Discord.Commands;
|
|
||||||
using Geekbot.Core;
|
|
||||||
using Geekbot.Core.ErrorHandling;
|
|
||||||
using Geekbot.Core.Extensions;
|
|
||||||
|
|
||||||
namespace Geekbot.Bot.Commands.Randomness.Greetings
|
|
||||||
{
|
|
||||||
public class Greetings : TransactionModuleBase
|
|
||||||
{
|
|
||||||
private readonly IErrorHandler _errorHandler;
|
|
||||||
|
|
||||||
public Greetings(IErrorHandler errorHandler)
|
|
||||||
{
|
|
||||||
_errorHandler = errorHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Command("hello", RunMode = RunMode.Async)]
|
|
||||||
[Alias("greeting", "hi", "hallo")]
|
|
||||||
[Summary("Say hello to the bot and get a reply in a random language")]
|
|
||||||
public async Task GetGreeting()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var greeting = await HttpAbstractions.Get<GreetingBaseDto>(new Uri("https://api.greetings.dev/v1/greeting"));
|
|
||||||
|
|
||||||
var eb = new EmbedBuilder();
|
|
||||||
eb.Title = greeting.Primary.Text;
|
|
||||||
eb.AddInlineField("Language", greeting.Language);
|
|
||||||
|
|
||||||
if (greeting.Primary.Dialect != null)
|
|
||||||
{
|
|
||||||
eb.AddInlineField("Dialect", greeting.Primary.Dialect);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (greeting.Primary.Romanization != null)
|
|
||||||
{
|
|
||||||
eb.AddInlineField("Roman", greeting.Primary.Romanization);
|
|
||||||
}
|
|
||||||
|
|
||||||
await ReplyAsync(string.Empty, false, eb.Build());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
await _errorHandler.HandleCommandException(e, Context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue