diff --git a/DiscordBot/Modules/Admin/AdminModule.cs b/DiscordBot/Modules/Admin/AdminModule.cs index 3a7b33c..78c9465 100644 --- a/DiscordBot/Modules/Admin/AdminModule.cs +++ b/DiscordBot/Modules/Admin/AdminModule.cs @@ -12,7 +12,6 @@ using DiscordBot.Common; using DiscordBot.Extensions; using DiscordBot.Objects; -using DiscordBot.Other; namespace DiscordBot.Modules.Admin { @@ -297,56 +296,5 @@ public async Task DenyQuote(int quoteId) await ReplyAsync("", false, eb.Build()); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("", false, eb.Build()); } - - [Command("addvotelink"), Summary("Add a voting link to the list.")] - public async Task AddVoteLink([Remainder]string link) - { - VoteLinkHandler.AddAndUpdateLinks(link); - - EmbedBuilder eb = new EmbedBuilder() - .WithDescription(Context.User.Mention + " Link Added") - .WithColor(33, 210, 47); - - await ReplyAsync("", false, eb.Build()); - } - - [Command("listvotelinks"), Summary("Sends a list of all the voting links.")] - public async Task ListVotingLinks() - { - StringBuilder sb = new StringBuilder() - .Append("**Voting Link List**\n```"); - - for (int i = 0; i < VoteLinkHandler.VoteLinkList.Count; i++) - { - sb.Append(i + ": " + VoteLinkHandler.VoteLinkList[i] + "\n"); - } - - sb.Append("```"); - - await ReplyAsync(sb.ToString()); - } - - [Command("editvotelink"), Summary("Edit a voting link from the list.")] - public async Task EditVotingLink(int linkId, [Remainder]string link) - { - string oldLink = VoteLinkHandler.VoteLinkList[linkId]; - VoteLinkHandler.UpdateLink(linkId, link); - await ReplyAsync(Context.User.Mention + " updated vote link id: " + linkId + "\nOld link: `" + oldLink + "`\nUpdated: `" + link + "`"); - } - - [Command("deletevotelink"), Summary("Delete a voting link from the list. Make sure to `$listvotelinks` to get the ID for the link being removed!")] - public async Task RemoveVotingLink(int linkId) - { - string link = VoteLinkHandler.VoteLinkList[linkId]; - VoteLinkHandler.RemoveAndUpdateLinks(linkId); - - EmbedBuilder eb = new EmbedBuilder() - .WithDescription(Context.User.Mention + " Link Removed\nLink: " + link) - .WithColor(210, 47, 33); - - await ReplyAsync("", false, eb.Build()); - - await ListVotingLinks().ConfigureAwait(false); - } } } diff --git a/DiscordBot/Modules/Public/InfoModule.cs b/DiscordBot/Modules/Public/InfoModule.cs index a654efc..03824c7 100644 --- a/DiscordBot/Modules/Public/InfoModule.cs +++ b/DiscordBot/Modules/Public/InfoModule.cs @@ -8,7 +8,6 @@ using DiscordBot.Common.Preconditions; using DiscordBot.Common; using DiscordBot.Objects; -using DiscordBot.Other; namespace DiscordBot.Modules.Public { @@ -89,22 +88,6 @@ public async Task PostEmailAddress() { await ReplyAsync("Send complaints to `MogiiCraft.@pizza@gmail.com`"); } - - [Command("vote"), Summary("Sends links to the voting websites for Minecraft.")] - public async Task SendVotingLinks() - { - StringBuilder sb = new StringBuilder() - .Append("**Vote Links**\n" + Context.User.Mention + " use the following links to vote and support the server. You'll be given some diamonds in-game to say thanks :D\n"); - - foreach (var link in VoteLinkHandler.VoteLinkList) - { - sb.Append("<" + link + ">\n"); - } - - sb.Append(""); - - await ReplyAsync(sb.ToString()); - } } } } diff --git a/DiscordBot/Other/VoteLinkHandler.cs b/DiscordBot/Other/VoteLinkHandler.cs deleted file mode 100644 index dd057cd..0000000 --- a/DiscordBot/Other/VoteLinkHandler.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Discord; -using DiscordBot.Extensions; - -namespace DiscordBot.Other -{ - public class VoteLinkHandler - { - private const string FileName = "MythicalCuddles/DiscordBot/common/voteLinks.txt"; - - public static List VoteLinkList = new List(); - - private static void LoadQuotes() - { - string file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), FileName); - VoteLinkList = File.ReadAllLines(file).ToList(); - - new LogMessage(LogSeverity.Info, "VoteLinkHandler", FileName + " loaded.").PrintToConsole(); - } - - public static void EnsureExists() - { - string file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), FileName); - if (!File.Exists(file)) - { - string path = Path.GetDirectoryName(file); - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - SaveLinks(); - - new LogMessage(LogSeverity.Info, "VoteLinkHandler", FileName + " created.").PrintToConsole(); - } - LoadQuotes(); - } - - private static void SaveLinks() - { - string file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), FileName); - File.WriteAllLines(file, VoteLinkList); - } - - public static void AddAndUpdateLinks(string link) - { - VoteLinkList.Add(link); - SaveLinks(); - } - - public static void RemoveAndUpdateLinks(int index) - { - VoteLinkList.RemoveAt(index); - SaveLinks(); - } - - public static void UpdateLink(int index, string link) - { - VoteLinkList[index] = link; - SaveLinks(); - } - } -} diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs index 9ea63b1..1cf16e5 100644 --- a/DiscordBot/Program.cs +++ b/DiscordBot/Program.cs @@ -8,7 +8,6 @@ using DiscordBot.Common; using DiscordBot.Database; using DiscordBot.Extensions; -using DiscordBot.Other; using MelissaNet; using MelissaNet.Modules; @@ -60,7 +59,6 @@ private static async void StartBot(string[] args) // Startup Method. // Check if application configurations exist. Configuration.EnsureExists(); StringConfiguration.EnsureExists(); - VoteLinkHandler.EnsureExists(); // Verify Settings bool invalidToken = false, invalidDbSettings = false;