public DiscordEventHandler(Logger logger, TriviaGames triviaGames, DiscordSocketClient client, CommandHandler commandHandler, ApplicationSettings applicationSettings, ListManager listManager, IOnboarding onboarding, BlogHandler blogHandler, Announcements announcements, MessageRewardHandler messageRewardHandler, RepeatedTaskFunctions repeatedTaskFunctions, GlobalGuildAccounts globalGuildAccounts) { _logger = logger; _client = client; _commandHandler = commandHandler; _applicationSettings = applicationSettings; _triviaGames = triviaGames; _listManager = listManager; _onboarding = onboarding; _blogHandler = blogHandler; _announcements = announcements; _messageRewardHandler = messageRewardHandler; _repeatedTaskFunctions = repeatedTaskFunctions; _globalGuildAccounts = globalGuildAccounts; }
public async Task AddLeaveMessage([Remainder] string message) { var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var response = $"Failed to add this Leave Message..."; if (!guildAcc.LeaveMessages.Contains(message)) { var messages = guildAcc.WelcomeMessages.ToList(); messages.Add(message); guildAcc.Modify(g => g.SetLeaveMessages(messages)); response = $"Successfully added `{message}` as Leave Message!"; } await ReplyAsync(response); }
public async Task RemovePrefix([Remainder] string prefix) { var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var response = $"Failed to remove the Prefix... Was `{prefix}` really a prefix?"; if (guildAcc.Prefixes.Contains(prefix)) { var prefixes = guildAcc.Prefixes.ToList(); prefixes.Remove(prefix); guildAcc.Modify(g => g.SetPrefixes(prefixes)); response = $"Successfully removed `{prefix}` as possible prefix!"; } await ReplyAsync(response); }
public async Task RemoveWelcomeMessage(int messageIndex) { var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var messages = guildAcc.WelcomeMessages.ToList(); var response = $"Failed to remove this Welcome Message... Use the number shown in `welcome list` next to the `#` sign!"; if (messages.Count > messageIndex - 1) { messages.RemoveAt(messageIndex - 1); guildAcc.Modify(g => g.SetWelcomeMessages(messages)); response = $"Successfully removed message #{messageIndex} as possible Welcome Message!"; } await ReplyAsync(response); }
public async Task SetChannelToBeIgnoredByFilter(string type, SocketGuildChannel chnl = null) { var guildUser = Context.User as SocketGuildUser; if (!guildUser.GuildPermissions.Administrator) { string description = $"{Global.ENo} **|** You Need the **Administrator** Permission to do that {Context.User.Username}"; var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description, EmbedHandler.EmbedMessageType.Exception); await ReplyAndDeleteAsync("", embed : errorEmbed); return; } var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithColor(Global.NayuColor); switch (type) { case "add": case "Add": config.NoFilterChannels.Add(chnl.Id); embed.WithDescription($"Added <#{chnl.Id}> to the list of ignored channels for Filter."); break; case "rem": case "Rem": config.NoFilterChannels.Remove(chnl.Id); embed.WithDescription($"Removed <#{chnl.Id}> from the list of ignored channels for Filter."); break; case "clear": case "Clear": config.NoFilterChannels.Clear(); embed.WithDescription("List of channels to be ignored by Filter has been cleared."); break; default: embed.WithDescription( $"Valid types are `add`, `rem`, and `clear`. Syntax: `n!fi {{add/rem/clear}} [channelMention]`"); break; } GlobalUserAccounts.SaveAccounts(Context.Guild.Id); await SendMessage(Context, embed.Build()); }
public async Task <Embed> ListAsync(ulong guildId) { var config = GlobalGuildAccounts.GetGuildAccount(guildId); var cmdPrefix = config.CommandPrefix; try { var descriptionBuilder = new StringBuilder(); var player = _lavaShardClient.GetPlayer(guildId); if (player == null) { return(await EmbedHandler.CreateErrorEmbed("Music Queue", $"Could not aquire music player.\nAre you using the music service right now? See `{cmdPrefix}h m` for proper usage.")); } if (player.IsPlaying) { if (player.Queue.Count < 1 && player.CurrentTrack != null) { return(await EmbedHandler.CreateBasicEmbed($"Now Playing: {player.CurrentTrack.Title}", "There are no other items in the queue.")); } else { var trackNum = 2; foreach (LavaTrack track in player.Queue.Items) { if (trackNum == 2) { descriptionBuilder.Append($"Up Next: [{track.Title}]({track.Uri})\n"); trackNum++; } else { descriptionBuilder.Append($"#{trackNum}: [{track.Title}]({track.Uri})\n"); trackNum++; } } return(await EmbedHandler.CreateBasicEmbed("Music Playlist", $"Now Playing: [{player.CurrentTrack.Title}]({player.CurrentTrack.Uri})\n{descriptionBuilder.ToString()}")); } } else { return(await EmbedHandler.CreateErrorEmbed("Music Queue", "Player doesn't seem to be playing anything right now. If this is an error, Please contact Stage in the Kaguya support server.")); } } catch (Exception ex) { return(await EmbedHandler.CreateErrorEmbed("Music, List", ex.Message)); } }
public static async Task Slowmode(SocketMessage s) { var msg = s as SocketUserMessage; var context = new ShardedCommandContext(_client, msg); var config = GlobalGuildAccounts.GetGuildAccount(context.Guild.Id); if (config.IsSlowModeEnabled) { if (context.User is IGuildUser user && user.GuildPermissions.ManageChannels) { return; } if (msg == null) { return; } if (msg.Channel == msg.Author.GetOrCreateDMChannelAsync()) { return; } if (msg.Author.IsBot) { return; } var userAcc = GlobalUserAccounts.GetUserAccount(msg.Author.Id); DateTime now = DateTime.UtcNow; if (now < userAcc.LastMessage.AddSeconds(config.SlowModeCooldown)) { var difference1 = now - userAcc.LastMessage; var time = new TimeSpan((long)config.SlowModeCooldown * 10000000); var difference = time - difference1; var timeSpanString = string.Format("{0:%s} seconds", difference); await msg.DeleteAsync(); var dm = await context.User.GetOrCreateDMChannelAsync(); await dm.SendMessageAsync( $"Slow down! You can send a message in **{timeSpanString}** in **{context.Guild.Name}**."); } else { userAcc.LastMessage = now; } } }
public async Task ListWelcomeMessages() { var welcomeMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).WelcomeMessages; var embB = new EmbedBuilder().WithTitle("No Welcome Messages set yet... add some if you want to greet incoming people! =)"); if (welcomeMessages.Count > 0) { embB.WithTitle("Possible Welcome Messages:"); } for (var i = 0; i < welcomeMessages.Count; i++) { embB.AddField($"Message #{i + 1}:", welcomeMessages[i]); } await ReplyAsync("", false, embB.Build()); }
public async Task ListWelcomeMessages() { var welcomeMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).WelcomeMessages; var embB = new EmbedBuilder().WithTitle("Nie mam ustawionych jeszcze żadnych wiadomości powitalnych... jeśli chcesz żeby nowi ludzie byli szczęśliwi, dodaj kilka ;)"); if (welcomeMessages.Count > 0) { embB.WithTitle("Wiadomości powitalne:"); } for (var i = 0; i < welcomeMessages.Count; i++) { embB.AddField($"Przykład #{i + 1}:", welcomeMessages[i]); } await ReplyAsync("", false, embB.Build()); }
public async Task ListLeaveMessages() { var leaveMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).LeaveMessages; var embB = new EmbedBuilder().WithTitle("Nie mam ustawionych jeszcze żadnych wiadomości pożegnalnych... jeśli chcesz żeby reszta serwera wiedziała o naszej \"stracie\", dodaj kilka ;)"); if (leaveMessages.Count > 0) { embB.WithTitle("Przykładowe wiadomości pożegnalne"); } for (var i = 0; i < leaveMessages.Count; i++) { embB.AddField($"Przykład #{i + 1}:", leaveMessages[i]); } await ReplyAsync("", false, embB.Build()); }
public async Task ListLeaveMessages() { var leaveMessages = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id).LeaveMessages; var embB = new EmbedBuilder().WithTitle("No Leave Messages set yet... add some if you want a message to be shown if someone leaves."); if (leaveMessages.Count > 0) { embB.WithTitle("Possible Leave Messages:"); } for (var i = 0; i < leaveMessages.Count; i++) { embB.AddField($"Message #{i + 1}:", leaveMessages[i]); } await ReplyAsync("", false, embB.Build()); }
public async Task Echo([Remainder] string message) { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); if (config.MassPingChecks) { if (message.Contains("@everyone") || message.Contains("@here")) { return; } } var embed = EmbedHandler.CreateEmbed(Context, "Echo!", message, EmbedHandler.EmbedMessageType.Success); await SendMessage(Context, embed); }
public async Task SetChannelToBeIgnoredByFilter(string type, SocketGuildChannel chnl = null) { var guser = Context.User as SocketGuildUser; if (guser.GuildPermissions.ManageMessages) { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithColor(37, 152, 255); switch (type) { case "add": case "Add": config.NoFilterChannels.Add(chnl.Id); GlobalGuildAccounts.SaveAccounts(); embed.WithDescription($"Added <#{chnl.Id}> to the list of ignored channels for Filter."); break; case "rem": case "Rem": config.NoFilterChannels.Remove(chnl.Id); GlobalGuildAccounts.SaveAccounts(); embed.WithDescription($"Removed <#{chnl.Id}> from the list of ignored channels for Filter."); break; case "clear": case "Clear": config.NoFilterChannels.Clear(); GlobalGuildAccounts.SaveAccounts(); embed.WithDescription("List of channels to be ignored by Filter has been cleared."); break; default: embed.WithDescription($"Valid types are `add`, `rem`, and `clear`. Syntax: `w!fi {{add/rem/clear}} [channelMention]`"); break; } await Context.Channel.SendMessageAsync("", embed : embed.Build()); } else { var embed = new EmbedBuilder(); embed.WithColor(37, 152, 255); embed.Title = $":x: | You Need the Administrator Permission to do that {Context.User.Username}"; await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5)); } }
private static bool CheckPrefix(ref int argPos, SocketCommandContext context) { var prefixes = GlobalGuildAccounts.GetGuildAccount(context.Guild.Id).Prefixes; var tmpArgPos = 0; var success = prefixes.Any(pre => { if (context.Message.Content.StartsWith(pre)) { tmpArgPos = pre.Length + 1; return(true); } return(false); }); argPos = tmpArgPos; return(success); }
public async Task VerifyGuildById(ulong guildId = 0) { var id = guildId; if (id == 0) { id = Context.Guild.Id; } var config = GlobalGuildAccounts.GetGuildAccount(id); config.VerifiedGuild = true; var embed = new EmbedBuilder() .WithDescription("Successfully verified this server.") .WithColor(37, 152, 255); await ReplyAsync("", embed : embed.Build()); }
public async Task ServerInfo(string guildName = null) { //Meh Just Some Local Variables OwO var guild = Context.Guild; var roles = guild.Roles; var users = guild.Users; int usercount = users.Count(x => x.IsBot == false); var gusersnobot = users.Where(x => x.IsBot == false); var gusersbotonly = users.Where(x => x.IsBot == true); var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var owner = guild.Owner; string afkname = null; if (guild.AFKChannel != null) { afkname = guild.AFKChannel.Name; } var embed = new EmbedBuilder(); embed.WithTitle("Server Info"); embed.AddField(guild.Name, guild.CreatedAt.ToString("dd'/'MM'/'yyyy hh:mm:ss tt")); embed.WithColor(240, 98, 146); embed.WithThumbnailUrl(guild.IconUrl); embed.AddField("› Owner", owner.ToString(), inline: true); //Server Owner. embed.AddField("› Members", guild.MemberCount.ToString(), inline: true); //User Count. embed.AddField("› Bots", $"{gusersbotonly.Count()}", inline: true); //Bot Count. embed.AddField("› Verification Level", guild.VerificationLevel.ToString(), inline: true); //Level Of Server Verification. embed.AddField("› Shard ID", Context.Client.ShardId, inline: true); // Shard ID. embed.AddField("› Text Channels", guild.TextChannels.Count.ToString(), inline: true); //Text Channel Count. embed.AddField("› Voice Channels", guild.VoiceChannels.Count.ToString(), inline: true); //Voice Channel Count. embed.AddField("› Region", guild.VoiceRegionId.ToString(), inline: true); //Region Of The Server. embed.AddField("› Roles", (guild.Roles.Count - 1).ToString(), inline: true); //How Many Roles The Server Has. embed.AddField("› Emoji", Context.Guild.Emotes.Count.ToString(), inline: true); //Emoji Count. embed.AddField("› Default Notifications", guild.DefaultMessageNotifications.ToString(), inline: true); // Personal int seconds = guild.AFKTimeout; string minutes = ((seconds % 3600) / 60).ToString(); embed.AddField("› AFK Timeout", minutes + " minutes", inline: true); //AFK Timeout Set For The Server. embed.AddField("› AFK Channel", afkname ?? "None Set", inline: true); //AFK Channel For The Server. //embed.AddField("› Verified Guild", config.VerifiedGuild, inline: true); embed.WithFooter($"#{guild.Id.ToString()}"); //Footer Of The Embed As Unique Server ID await Context.Channel.SendMessageAsync("", embed : embed.Build()); //Send The Embed Where The Command Was Excuted. }
public async Task RbpStatus() { var rbp = GlobalGuildAccounts.GetGuildAccount(Context.Guild).RoleByPhraseSettings; var phrases = rbp.Phrases.Any() ? string.Join("\n", rbp.Phrases.Select(p => $"({rbp.Phrases.IndexOf(p)}) - {p}")) : "No phrases stored\nAdd one with `rbp addPhrase YOUR-PHRASE`"; var roles = rbp.RolesIds.Any() ? string.Join("\n", rbp.RolesIds.Select(r => $"({rbp.RolesIds.IndexOf(r)}) - {Context.Guild.GetRole(r).Name}")) : "No roles stored\nAdd one with `rbp addRole @SomeRole`"; var relations = rbp.Relations.Any() ? string.Join("\n", rbp.Relations.Select(r => $"Phrase {r.PhraseIndex} => Role {r.RoleIdIndex}")) : "No relations created\nAdd one with `rbp addRelation PHRASE-ID ROLE-ID`"; var embed = new EmbedBuilder(); embed.WithTitle($"Role Assignments for {Context.Guild.Name}"); embed.AddField("Phrases", phrases); embed.AddField("Roles", roles); embed.AddField("Relations", relations); await Context.Channel.SendMessageAsync("", embed : embed.Build()); }
public static async Task EvaluateMessage(IGuild guild, string message, IGuildUser sender) { var guildSettings = GlobalGuildAccounts.GetGuildAccount(guild); var triggeredPhrases = guildSettings.RoleByPhraseSettings.Phrases.Where(message.Contains).ToList(); if (!triggeredPhrases.Any()) { return; } var roleIdsToGet = new List <ulong>(); foreach (var phrase in triggeredPhrases) { var phraseIndex = guildSettings.RoleByPhraseSettings.Phrases.IndexOf(phrase); var roleIds = guildSettings.RoleByPhraseSettings.Relations .Where(r => r.PhraseIndex == phraseIndex) .Select(r => guildSettings.RoleByPhraseSettings.RolesIds.ElementAt(r.RoleIdIndex)) .ToList(); foreach (var roleId in roleIds) { if (roleIdsToGet.Contains(roleId)) { continue; } roleIdsToGet.Add(roleId); } } foreach (var roleId in roleIdsToGet) { if (sender.RoleIds.Contains(roleId)) { continue; } var role = guild.GetRole(roleId); if (role is null) { continue; } await sender.AddRoleAsync(role); } }
public async Task CustomCommandList() { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var cmds = config.CustomCommands; var embed = new EmbedBuilder().WithTitle("No custom commands set up yet... add some!"); if (cmds.Count > 0) { embed.WithTitle("Here are all available custom commands:"); } foreach (var cmd in cmds) { embed.AddField(cmd.Key, cmd.Value, true); } await SendMessage(Context, embed.Build()); }
public async Task AddPotatos(uint Money, IGuildUser user, [Remainder] string arg = "") { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var userAccount = GlobalUserAccounts.GetUserAccount((SocketUser)user); userAccount.Money += Money; GlobalUserAccounts.SaveAccounts(); var embed = new EmbedBuilder(); embed.WithColor(37, 152, 255); embed.WithTitle($":white_check_mark: | **{Money}** {config.Currency} were added to " + target.Username + "'s account."); await Context.Channel.SendMessageAsync("", embed : embed.Build()); }
public async Task GetPrefixForServer() { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); string prefix; switch (config) { case null: prefix = "w!"; break; default: prefix = config.CommandPrefix; break; } await Context.Channel.SendMessageAsync($"The prefix for this server is {prefix}."); }
public async Task ShowRichesPeople(int page = 1) { if (page < 1) { await ReplyAsync("Are you really trying that right now? ***REALLY?***"); return; } var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var guildUserIds = Context.Guild.Users.Select(user => user.Id); var accounts = GlobalUserAccounts.GetFilteredAccounts(acc => guildUserIds.Contains(acc.Id)); const int usersPerPage = 9; // Calculate the highest accepted page number => amount of pages we need to be able to fit all users in them // (amount of users) / (how many to show per page + 1) results in +1 page more every time we exceed our usersPerPage var lastPageNumber = 1 + (accounts.Count / (usersPerPage + 1)); if (page > lastPageNumber) { await ReplyAsync($"There are not that many pages...\nPage {lastPageNumber} is the last one..."); return; } // Sort the accounts descending by currency var ordered = accounts.OrderByDescending(acc => acc.Taiyaki).ToList(); var embB = new EmbedBuilder() .WithTitle($"{config.Currency} Leaderboard:") .WithFooter($"Page {page}/{lastPageNumber}"); page--; for (var i = 1; i <= usersPerPage && i + usersPerPage * page <= ordered.Count; i++) { var account = ordered[i - 1 + usersPerPage * page]; var user = Global.Client.GetUser(account.Id); embB.WithColor(Global.NayuColor); embB.AddField($"#{i + usersPerPage * page} {user.Username}", $"{account.Taiyaki} {config.Currency}", true); } await ReplyAsync("", false, embB.Build()); }
public async Task Promote(string rank, IGuildUser user = null) { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var guser = Context.User as SocketGuildUser; if (guser.GuildPermissions.ManageRoles) { try { if (rank == "admin" || rank == "administrator") { var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == config.AdminRoleName);; await user.AddRoleAsync(role); await ReplyAsync(":confetti_ball: | " + Context.User.Mention + " promoted " + user.Mention + " to the " + config.AdminRoleName + " rank! Congratulations!"); } if (rank == "mod" || rank == "moderator") { var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == config.ModRoleName);; await user.AddRoleAsync(role); await ReplyAsync(":confetti_ball: | " + Context.User.Mention + " promoted " + user.Mention + " to the " + config.ModRoleName + " rank! Congratulations!"); } if (rank == "helper") { var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == config.HelperRoleName);; await user.AddRoleAsync(role); await ReplyAsync(":confetti_ball: | " + Context.User.Mention + " promoted " + user.Mention + " to the " + config.HelperRoleName + " rank! Congratulations!"); } } catch { var embed = new EmbedBuilder(); embed.WithColor(37, 152, 255); embed.WithTitle(":hand_splayed: | Please say who and what you want to promote the user to. Ex: w!promote <rank> <@username>"); await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5)); } } else { var embed = new EmbedBuilder(); embed.WithColor(37, 152, 255); embed.Title = $":x: | You need the Manange Roles Permission to do that {Context.User.Username}"; await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5)); } }
public async Task AddTaiyakis(uint Taiyaki, IGuildUser user) { var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); SocketUser target; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var userAccount = GlobalUserAccounts.GetUserAccount((SocketUser)user); userAccount.Taiyaki += Taiyaki; GlobalUserAccounts.SaveAccounts(userAccount.Id); var embed = new EmbedBuilder(); embed.WithColor(Global.NayuColor); embed.WithTitle( $"✅ **|** **{Taiyaki}** {config.Currency} were added to " + target.Username + "'s account."); await SendMessage(Context, embed.Build()); }
public async Task LewdIMGChannel(ITextChannel channel) { var guser = Context.User as SocketGuildUser; if (guser.GuildPermissions.Administrator) { var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); guildAcc.AutoLewdChannel = channel.Id; GlobalGuildAccounts.SaveAccounts(Context.Guild.Id); await ReplyAsync("The AutoLewd-Channel has been set to " + channel.Mention); } else { var embed = new EmbedBuilder(); embed.WithColor(37, 152, 255); embed.Title = $":x: | You Need the Administrator Permission to do that {Context.User.Username}"; var use = await ReplyAndDeleteAsync("", embed : embed.Build(), timeout : TimeSpan.FromSeconds(5)); } }
internal static string RemoveTag(string tagName, IGlobalAccount account) { if (!account.Tags.ContainsKey(tagName)) { return("PROTIP: Nie możesz usunąć tagu, który nie istnieje..."); } account.Tags.Remove(tagName); if (account is GlobalGuildAccount) { GlobalGuildAccounts.SaveAccounts(account.Id); } else { GlobalUserAccounts.SaveAccounts(account.Id); } return($"Usunąłem tag z nazwą: {tagName}!"); }
internal static string UpdateTag(string tagName, string tagContent, IGlobalAccount account) { if (!account.Tags.ContainsKey(tagName)) { return("Zaktualizować, tak? Coś czego nie ma, tak?"); } account.Tags[tagName] = tagContent; if (account is GlobalGuildAccount) { GlobalGuildAccounts.SaveAccounts(account.Id); } else { GlobalUserAccounts.SaveAccounts(account.Id); } return($"Zaktualizowałem tag z nazwą: {tagName}!"); }
internal static string RemoveTag(string tagName, IGlobalAccount account) { if (!account.Tags.ContainsKey(tagName)) { return("You can't remove a tag that doesn't exist..."); } account.Tags.Remove(tagName); if (account is GlobalGuildAccount) { GlobalGuildAccounts.SaveAccounts(account.Id); } else { GlobalUserAccounts.SaveAccounts(account.Id); } return($"Successfully removed the tag {tagName}!"); }
public async Task SetRoleOnJoin(string role = null) { string text; var guild = GlobalGuildAccounts.GetGuildAccount(Context.Guild); if (role == null) { guild.RoleOnJoin = null; text = $"No one will get role on join from me!"; } else { guild.RoleOnJoin = role; text = $"Everyone will now be getting {role} role on join!"; } GlobalGuildAccounts.SaveAccounts(Context.Guild.Id); await ReplyAsync(text); }
internal static string UpdateTag(string tagName, string tagContent, IGlobalAccount account) { if (!account.Tags.ContainsKey(tagName)) { return("You can't update a tag that doesn't exist..."); } account.Tags[tagName] = tagContent; if (account is GlobalGuildAccount) { GlobalGuildAccounts.SaveAccounts(account.Id); } else { GlobalUserAccounts.SaveAccounts(account.Id); } return($"Successfully updated the tag {tagName}!"); }