From 245e88726a248c03a55ab020f3986d2af8489a2f Mon Sep 17 00:00:00 2001 From: Daan Boerlage Date: Fri, 22 Jul 2022 18:00:54 +0200 Subject: [PATCH] Remove the !hello/greeting command, the api is no longer available --- .../Randomness/Greetings/GreetingBaseDto.cs | 22 -------- .../Randomness/Greetings/GreetingDto.cs | 19 ------- .../Randomness/Greetings/Greetings.cs | 51 ------------------- 3 files changed, 92 deletions(-) delete mode 100644 src/Bot/Commands/Randomness/Greetings/GreetingBaseDto.cs delete mode 100644 src/Bot/Commands/Randomness/Greetings/GreetingDto.cs delete mode 100644 src/Bot/Commands/Randomness/Greetings/Greetings.cs diff --git a/src/Bot/Commands/Randomness/Greetings/GreetingBaseDto.cs b/src/Bot/Commands/Randomness/Greetings/GreetingBaseDto.cs deleted file mode 100644 index 684ee5b..0000000 --- a/src/Bot/Commands/Randomness/Greetings/GreetingBaseDto.cs +++ /dev/null @@ -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; } - } -} \ No newline at end of file diff --git a/src/Bot/Commands/Randomness/Greetings/GreetingDto.cs b/src/Bot/Commands/Randomness/Greetings/GreetingDto.cs deleted file mode 100644 index db7c8b6..0000000 --- a/src/Bot/Commands/Randomness/Greetings/GreetingDto.cs +++ /dev/null @@ -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; } - } -} \ No newline at end of file diff --git a/src/Bot/Commands/Randomness/Greetings/Greetings.cs b/src/Bot/Commands/Randomness/Greetings/Greetings.cs deleted file mode 100644 index c32ee6d..0000000 --- a/src/Bot/Commands/Randomness/Greetings/Greetings.cs +++ /dev/null @@ -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(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); - } - } - } -} \ No newline at end of file