public static async Task Maindo(SocketMessage arg) { if (Economy.CountProductForUser(Product.flower, arg.Author.Id) > 0) { var User = arg.MentionedUsers.Count >= 1 ? arg.MentionedUsers.First() : null; if (User == null) { await arg.Channel.SendMessageAsync("Please mention a user to give the flower to!"); var WFR = new WaitForResponse() { TimeLimitS = 15, ChannelId = arg.Channel.Id, UserId = arg.Author.Id }; var Msg = await WFR.Start(); User = Msg.MentionedUsers.Count > 0 ? Msg.MentionedUsers.First() : null; } await arg.Channel.SendMessageAsync($"You gave {User.Mention} a flower! <3"); Economy.ChangeProductCountForUser(Product.flower, -1, arg.Author.Id); Economy.ChangeProductCountForUser(Product.flower, 1, User.Id); } else { await arg.Channel.SendMessageAsync($"You need to buy flowers first! `{Program.Prefix}buy flower`"); } }
public static async Task Maindo(SocketMessage arg) { try { long Count = 1; long CountOfProductsForUser = Economy.CountProductForUser(Product.pills, arg.Author.Id); if (arg.Content.ToLower().Split(' ').Length >= 2) { if (!long.TryParse(arg.Content.ToLower().Split(' ')[1], out Count)) { Count = 1; } } if (CountOfProductsForUser >= Count) { var Prompt = new Prompt() { ChannelForPrompt = arg.Channel, MaxTime = 10, Options = new Emoji[] { new Emoji("\uD83D\uDC4D"), new Emoji("\uD83D\uDC4E") }, Target = arg.Author, Title = $"Are you sure you want to take pills? (x{Count})" }; var Response = await Prompt.ShowPrompt(); if (Response != null && Response.Name == "👍") { Economy.ChangeProductCountForUser(Product.pills, -Count, arg.Author.Id); await TakePills(arg, Count); } else { await arg.Channel.SendMessageAsync("kk."); } } else { await arg.Channel.SendMessageAsync($"You need to buy {Count} pill(s) first."); } } catch (Exception e) { Console.WriteLine(e); } }
public static async Task Maindo(SocketMessage arg) { if (Economy.CountProductForUser(Product.phone, arg.Author.Id) > 0) { var ThisType = Type.GetType("MGX_Discord_Bot.EModules.Commands.General.phone"); if (arg.Content.Contains(" ")) { var AskedMethod = ThisType.GetMethod(arg.Content.ToLower().Split(' ')[1].Split(' ')[0], BindingFlags.Static | BindingFlags.NonPublic); if (AskedMethod != null) { AskedMethod.Invoke(null, new[] { arg }); } else { await arg.Channel.SendMessageAsync("That command doesn't exist!"); } } else { var Embed = new EmbedBuilder() { Color = new Color(125, 255, 240), Timestamp = DateTime.UtcNow, Footer = new EmbedFooterBuilder() { Text = "Phone commands!" }, }; string All = ""; foreach (var Method in ThisType.GetMethods(BindingFlags.Static | BindingFlags.NonPublic)) { All += $"`{Program.Prefix}phone {Method.Name.ToLower()}`\n"; } Embed.AddField(new EmbedFieldBuilder() { Name = "Phone Usage", Value = All }); await arg.Channel.SendMessageAsync("", false, Embed.Build()); } } else { await arg.Channel.SendMessageAsync($"You need to buy a phone first! `{Program.Prefix}buy phone`"); } }
public static async Task Maindo(SocketMessage arg) { string Key = $"PADLOCK-ACTIVE"; if (StoreHandler.LoadData(arg.Author.Id, Key) != null) { await arg.Channel.SendMessageAsync("You already have a padlock active!"); } else if (Economy.CountProductForUser(Product.padlock, arg.Author.Id) > 0) { Economy.ChangeProductCountForUser(Product.padlock, -1, arg.Author.Id); StoreHandler.SaveData(arg.Author.Id, Key, true); await arg.Channel.SendMessageAsync("Padlock is now active on your balance! This is one-time use, when someone tries to steal from you they will fail immediately."); } else { await arg.Channel.SendMessageAsync("You need to buy a padlock to use this!"); } }
private static async Task TakePills(SocketMessage arg, long Multiplier) { var User = arg.Author as SocketGuildUser; long CurrentSize = ppsize.GetSize(User.Id); var Random = new Random(); long IncreaseRate = Random.Next(5, 15) * Multiplier; long DecreaseRate = Random.Next(5, 30) * Multiplier; bool Increases = Random.Next(1, 3) == 1; if (Increases) { ppsize.SaveNewSize(User.Id, CurrentSize + IncreaseRate); await arg.Channel.SendMessageAsync($"Congrats! They worked.\n`PP Change: +{IncreaseRate}`\n`Pills Left: {Economy.CountProductForUser(Product.pills, arg.Author.Id)}`"); } else { ppsize.SaveNewSize(User.Id, CurrentSize - DecreaseRate); await arg.Channel.SendMessageAsync($"{AllNegate[Random.Next(1, AllNegate.Count)]}\n`PP Change: -{DecreaseRate}`\n`Pills Left: {Economy.CountProductForUser(Product.pills, arg.Author.Id)}`"); } }