public async Task ListTags() { var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); var emb = TagFunctions.BuildTagListEmbed(userAcc); await ReplyAsync("", false, emb); }
public async Task RemoveTag(string tagName) { var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); var response = TagFunctions.RemoveTag(tagName, userAcc); await ReplyAsync(response); }
public async Task UpdateTag(string tagName, [Remainder] string tagContent) { var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); var response = TagFunctions.UpdateTag(tagName, tagContent, userAcc); await ReplyAsync(response); }
internal static TransferResult UserToUser(IUser from, IUser to, ulong amount) { if (from.Id == to.Id) { return(TransferResult.SelfTransfer); } if (to.Id == Global.Client.CurrentUser.Id) { return(TransferResult.TransferToBot); } var transferSource = GlobalUserAccounts.GetUserAccount(from.Id); if (transferSource.Miunies < amount) { return(TransferResult.NotEnoughMiunies); } var transferTarget = GlobalUserAccounts.GetUserAccount(to.Id); transferSource.Miunies -= amount; transferTarget.Miunies += amount; GlobalUserAccounts.SaveAccounts(transferSource.Id, transferTarget.Id); return(TransferResult.Success); }
public static Task CheckDuelRewards(SocketUser user) { var config = GlobalUserAccounts.GetUserAccount(user); uint wins = config.Wins; switch (wins) { case (10): config.Title = "Classic Adventurer"; break; case (20): config.Title = "Courageous Explorer"; break; case (30): config.Title = "Daring Knight"; break; case (40): config.Title = "Monster Hunter"; break; case (50): config.Title = ("Noble Swordsman"); break; case (60): config.Title = ("Valiant Paladin"); break; case (70): config.Title = ("Dragon Slayer"); break; case (80): config.Title = ("Respectable Hero"); break; case (90): config.Title = ("Holy Protectorate"); break; case (100): config.Title = ("Saint"); break; case (120): config.Title = ("Defender of Gods"); break; case (150): config.Title = ("God Eater"); break; } GlobalUserAccounts.SaveAccounts(config.Id); return(Task.CompletedTask); }
public async Task ClearFavs() { var account = GlobalUserAccounts.GetUserAccount(Context.User.Id); account.Favorites.Clear(); GlobalUserAccounts.SaveAccounts(account.Id); await Context.Channel.SendMessageAsync("Favorites Cleared"); }
public async Task SetInvFromJson([Remainder] string jsonText) { // get the calling user userAccount = GlobalUserAccounts.GetUserAccount(Context.User.Id); userAccount.Inv = JsonConvert.DeserializeObject <Inventory>(jsonText); await Context.Channel.SendMessageAsync("RIGHTEOUS, we got itams!"); }
public async Task RemoveTag(string tagName) { var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); var response = TagFunctions.RemoveTag(tagName, userAcc); var embed = EmbedHandler.CreateEmbed(Context, "Success!", response, EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public async Task GetJson([Remainder] string name = null) { // get the calling user userAccount = GlobalUserAccounts.GetUserAccount(Context.User.Id); // get json response string msg = "Your inventory itams... \n" + userAccount.Inv.ToJson(name); // send json response await Context.Channel.SendMessageAsync(msg); }
public MiunieCommandContext(DiscordSocketClient client, SocketUserMessage msg) : base(client, msg) { if (User is null) { return; } UserAccount = GlobalUserAccounts.GetUserAccount(User); }
public async Task UpdateTag(string tagName, [Remainder] string tagContent) { var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); tagContent.Replace("@everyone", "@\u200beveryone").Replace("@here", "@\u200bhere"); var response = TagFunctions.UpdateTag(tagName, tagContent, userAcc); await ReplyAsync(response); }
public async Task AddJsonItem([Remainder] string jsonText) { // get the calling user userAccount = GlobalUserAccounts.GetUserAccount(Context.User.Id); Item itm = JsonConvert.DeserializeObject <Item>(jsonText); userAccount.Inv.AddItem(itm); await Context.Channel.SendMessageAsync("GR00VY new itam we got there!"); }
public async Task AddCapsules() { var config = GlobalUserAccounts.GetUserAccount(Context.User); config.MythicalCapsule = +3; config.NormalCapsule = +3; config.ShinyCapsule = +3; GlobalUserAccounts.SaveAccounts(Context.User.Id); await SendMessage(Context, null, "done now u can go die"); }
public async Task CheckPotatos([Remainder] string arg = "") { SocketUser target = null; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var account = GlobalUserAccounts.GetUserAccount(target); await ReplyAsync(GetPotatosReport(account.Money, target.Username, target.Mention)); }
public async Task CoinFlip(string side, uint amount = 0) { var config = GlobalUserAccounts.GetUserAccount(Context.User); if (config.Taiyaki < amount) { await SendMessage(Context, null, "Do you think you can trick me, you liar? (Not enough Taiyaki)"); return; } config.Taiyaki = config.Taiyaki - amount; Random rand = new Random(); string sid = side.ToLower(); var embed = new EmbedBuilder(); embed.WithColor(Global.NayuColor); embed.WithTitle($"<:coin:459944364546981909> Coin Flip for {amount} Taiyakis on the Side of {sid}."); if (sid == "tails") { int randomNumber = rand.Next(1, 4); //you know gambling is dangerous right lol you have a low chance of winning :) if (randomNumber == 1) //win { config.Taiyaki = config.Taiyaki + ((ulong)amount * 2); embed.WithDescription( $"I guess heads. And the coin landed on tails! Alright, you beat me, for *now*. Here's **{amount * 2}** Taiyakis!"); } else { embed.WithDescription( $"I guess heads. And the coin landed on heads! Sorry **{Context.User.Username}**, but your **{amount}** Taiyakis are mine non!"); } } if (sid == "heads") { int randomNumber = rand.Next(1, 4); //you know gambling is dangerous right lol if (randomNumber == 1) //win { config.Taiyaki = config.Taiyaki + ((ulong)amount * 2); embed.WithDescription( $"I guess tails. And the coin landed on heads! Alright, you beat me, for *now*. Here's **{amount * 2}** Taiyakis!"); } else { embed.WithDescription( $"I guess tails. And the coin landed on tails! Sorry **{Context.User.Username}**, but your **{amount}** Taiyakis are mine non!"); } } GlobalUserAccounts.SaveAccounts(config.Id); await SendMessage(Context, embed.Build()); }
public async Task UpdateTag(string tagName, [Remainder] string tagContent) { var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); tagContent.Replace("@everyone", "@\u200beveryone").Replace("@here", "@\u200bhere"); var response = TagFunctions.UpdateTag(tagName, tagContent, userAcc); var embed = EmbedHandler.CreateEmbed(Context, "Success!", response, EmbedHandler.EmbedMessageType.Success, false); await SendMessage(Context, embed); }
public static AttackResult SlashAttack(ShardedCommandContext context) { var config = GlobalUserAccounts.GetUserAccount(context.User); var player2 = context.Guild.GetUser(config.OpponentId); var choms = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId); var chom1 = choms.Item1; var chom2 = choms.Item2; string response; var dmg = (int)Math.Round(Attack.Damage * chom1.CP * .05); var accuracy = Global.Rng.Next(1, Attack.Accuracy + 1); if (accuracy > 1) { var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg); dmg = result.Item1; var modifier = result.Item2; var block = CheckModifiers.CheckForBlock(context.User, player2, dmg); var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg); if (block.Item1) { chom2.Health -= (uint)block.Item3; GlobalUserAccounts.SaveAccounts(config.Id); response = $":dagger: | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}"; dmg = block.Item3; } else if (deflect.Item1) { chom2.Health -= (uint)deflect.Item2; chom1.Health -= (uint)deflect.Item2; GlobalUserAccounts.SaveAccounts(config.Id); response = $":dagger: | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}"; dmg = deflect.Item2; } else { chom2.Health -= (uint)dmg; GlobalUserAccounts.SaveAccounts(config.Id); response = $":dagger: | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n**{chom1.Name}** has **{chom1.Health}** health left!\n{Helpers.GetHpLeft(chom1, chom2)}"; } } else { response = $":dash: **|** **{context.User.Username}**, your attack missed!"; } return(new AttackResult { Success = true, Response = response, Damage = dmg }); }
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 == true) { 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}**."); return; } else { userAcc.LastMessage = now; return; } } else { return; } }
public async Task AddReminder([Remainder] string args) { string[] splittedArgs = null; if (args.Contains(" in ")) { splittedArgs = args.Split(new string[] { " in " }, StringSplitOptions.None); } if (splittedArgs == null || splittedArgs.Length < 2) { await ReplyAsync("I think you are confused about how to use this command... aren't you?\n" + "Let me REMIND you it is: `remind DO THE THING! :rage: in 2d 23h 3m 12s`\n" + "And the ` in ` before the timeparameters is very important you little dumbo you..."); return; } var timeString = splittedArgs[splittedArgs.Length - 1]; if (timeString == "24h") { timeString = "1d"; } splittedArgs[splittedArgs.Length - 1] = ""; var reminderString = string.Join(" in ", splittedArgs, 0, splittedArgs.Length - 1); var timeDateTime = DateTime.UtcNow + TimeSpan.ParseExact(timeString, ReminderFormat.Formats, CultureInfo.CurrentCulture); var newReminder = new ReminderEntry(timeDateTime, reminderString); var account = GlobalUserAccounts.GetUserAccount(Context.User.Id); account.Reminders.Add(newReminder); GlobalUserAccounts.SaveAccounts(Context.User.Id); var timezone = account.TimeZone ?? "UTC"; TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById($"{timezone}"); var localTime = TimeZoneInfo.ConvertTimeFromUtc(timeDateTime, tz); var bigmess2 = $"{reminderString}\n\n" + $"We will send you a DM in __**{localTime}**__ `by {timezone}`\n"; var embed = new EmbedBuilder(); embed.WithAuthor(Context.User); embed.WithCurrentTimestamp(); embed.WithColor(Color.Blue); embed.WithTitle("I will remind you through DM:"); embed.AddField($"**____**", $"{bigmess2}"); ReplyAsync("", false, embed.Build()); }
public async Task AddReminder([Remainder] string args) { string[] splittedArgs = null; if (args.Contains(" za ")) { splittedArgs = args.Split(new string[] { " za " }, StringSplitOptions.None); } if (splittedArgs == null || splittedArgs.Length < 2) { await ReplyAsync("Pozwól biedna owieczko że wytłumaczę Ci jak to zrobić... OK?\n" + "Czyli tak: `<p>p <Czynności> za 2d 23h 3m 12s`\n" + "I to \"za\" jest troszkę ważne ^^"); return; } var timeString = splittedArgs[splittedArgs.Length - 1]; if (timeString == "24h") { timeString = "1d"; } splittedArgs[splittedArgs.Length - 1] = ""; var reminderString = string.Join(" za ", splittedArgs, 0, splittedArgs.Length - 1); var timeDateTime = DateTime.UtcNow + TimeSpan.ParseExact(timeString, ReminderFormat.Formats, CultureInfo.CurrentCulture); var newReminder = new ReminderEntry(timeDateTime, reminderString); var account = GlobalUserAccounts.GetUserAccount(Context.User.Id); account.Reminders.Add(newReminder); GlobalUserAccounts.SaveAccounts(Context.User.Id); var timezone = account.TimeZone ?? "UTC"; TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById($"{timezone}"); var localTime = TimeZoneInfo.ConvertTimeFromUtc(timeDateTime, tz); var bigmess2 = $"{reminderString}\n\n" + $"Wyślę Ci **DM**esa za __**{localTime}**__ `by {timezone}`\n"; var embed = new EmbedBuilder(); embed.WithAuthor(Context.User); embed.WithCurrentTimestamp(); embed.WithColor(Color.Blue); embed.WithTitle("Przypomnę Ci przez **DM**esa:"); embed.AddField($"**____**", $"{bigmess2}"); ReplyAsync("", false, embed.Build()); }
public static PotionResult EqualizerPotion(ShardedCommandContext context, Core.Entities.Chomusuke chom1, Core.Entities.Chomusuke chom2, ulong target) { var potionName = "Equalizer Potion"; var config = GlobalUserAccounts.GetUserAccount(context.User); var check = CheckForPotion(potionName, config); if (!check.Success) { return new PotionResult { Success = false, Response = check.Response } } ; string response = string.Empty; config.Items[potionName] -= 1; if (target == context.User.Id) { if (chom1.PotionEffects == null) { response = $"**{context.User.Mention}**, you cant use an **{potionName}** on yourself because you don't have any active potion effects!"; return(new PotionResult { Success = false, Response = response }); } chom1.PotionEffects.Clear(); response = $"**{context.User.Mention}** used a **{potionName}** on {chom1.Name}!"; GlobalUserAccounts.SaveAccounts(config.Id); return(new PotionResult { Success = true, Response = response }); } //opponent if (chom2.PotionEffects == null) { response = $"**{context.User.Mention}**, you cant use a **{potionName}** on your opponent because they don't have any active potion effects!"; return(new PotionResult { Success = false, Response = response }); } chom2.PotionEffects.Clear(); response = $"**{context.User.Mention}** used a **{potionName}** on {chom2.Name}!"; GlobalUserAccounts.SaveAccounts(config.OpponentId); return(new PotionResult { Success = true, Response = response }); }
public async Task CheckTaiyakis([Remainder] string arg = "") { SocketUser target; var mentionedUser = Context.Message.MentionedUsers.FirstOrDefault(); target = mentionedUser ?? Context.User; var config = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id); var account = GlobalUserAccounts.GetUserAccount(target.Id); await SendMessage(Context, null, $"{Global.ETaiyaki} **|** {target.Mention} has **{account.Taiyaki} {config.Currency}**!"); }
public async Task ShowFavs() { StringBuilder stringBuilder = new StringBuilder(); var account = GlobalUserAccounts.GetUserAccount(Context.User.Id); foreach (var keyValue in account.Favorites) { stringBuilder.Append($" {keyValue.Key}: {keyValue.Value}\n"); } await Context.Channel.SendMessageAsync(stringBuilder.ToString()); }
public async Task RemoveFav([Remainder] string phrase) { var account = GlobalUserAccounts.GetUserAccount(Context.User.Id); if (account.Favorites.ContainsKey(phrase)) { account.Favorites.Remove(phrase); GlobalUserAccounts.SaveAccounts(Context.User.Id); } await Context.Channel.SendMessageAsync($"Removed: {phrase}"); }
public async Task FetchLink([Remainder] string phrase) { string responce = ""; var account = GlobalUserAccounts.GetUserAccount(Context.User.Id); if (account.Favorites.ContainsKey(phrase)) { responce = $"Successfully fetched {account.Favorites[phrase]}"; } await Context.Channel.SendMessageAsync(responce); }
public static PotionResult DebuffPotion(ShardedCommandContext context, Core.Entities.Chomusuke chom1, Core.Entities.Chomusuke chom2, ulong target) { var potionName = "Debuff Potion"; var config = GlobalUserAccounts.GetUserAccount(context.User); var player2 = context.Guild.GetUser(config.OpponentId); var check = CheckForPotion(potionName, config); if (!check.Success) { return new PotionResult { Success = false, Response = check.Response } } ; string response = string.Empty; if (chom1.PotionEffects["Debuff"] <= 25 || !chom1.PotionEffects.Keys.Contains("Debuff") || chom2.PotionEffects["Debuff"] <= 25 || !chom2.PotionEffects.Keys.Contains("Debuff")) { config.Items[potionName] -= 1; if (target == context.User.Id) { chom1.PotionEffects.Add("Debuff", 0); chom1.PotionEffects["Debuff"] += 5; response = $"**{context.User.Mention}** used a **{potionName}** on {chom1.Name}!"; GlobalUserAccounts.SaveAccounts(config.Id); return(new PotionResult { Success = true, Response = response }); } if (target == player2.Id) { chom1.PotionEffects.Add("Debuff", 0); chom2.PotionEffects["Debuff"] += 5; response = $"**{context.User.Mention}** used a **{potionName}** on {chom2.Name}!"; GlobalUserAccounts.SaveAccounts(player2.Id); return(new PotionResult { Success = true, Response = response }); } } response = $"**{context.User.Mention}**, you cant use a **{potionName}** because both players are already at the max debuff level (25%)!"; return(new PotionResult { Success = false, Response = response }); }
public async Task ShowTag(string tagName = "") { if (string.IsNullOrWhiteSpace(tagName)) { await ReplyAsync("Musisz podać nazwę tagu. Spróbuj ``<p>t <NazwaTagu>``"); return; } var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id); var response = TagFunctions.GetTag(tagName, userAcc); await ReplyAsync(response); }
public static bool CheckForReinforcedArmour(SocketUser defender) { var config = GlobalUserAccounts.GetUserAccount(defender); if (config.armour == "reinforced") { return(true); } else { return(false); } }
public async Task DeleteReminder(int index) { var reminders = GlobalUserAccounts.GetUserAccount(Context.User.Id).Reminders; var responseString = "Ehhh... może najpier użyj `<p> lista` zanim zaczniesz usuwać przypomnienia które nie istnieją? :grin:"; if (index > 0 && index <= reminders.Count) { reminders.RemoveAt(index - 1); GlobalUserAccounts.SaveAccounts(Context.User.Id); responseString = $"Usunąłem przypomnienie numer {index}!"; } await ReplyAsync(responseString); }
public static async Task CreateAndSendMessageAsync(string title, string content, DateTime time, SocketUser user) { var config = GlobalUserAccounts.GetUserAccount(user); Message createdMessage = new Message(null, null, DateTime.MinValue, false, 0); createdMessage.Title = title; createdMessage.Content = content; createdMessage.Time = time; createdMessage.ID = config.InboxIDTracker; config.InboxIDTracker++; config.Inbox.Add(createdMessage); GlobalUserAccounts.SaveAccounts(user.Id); }