Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Discord.Commands;
- using Discord.WebSocket;
- using System.Threading.Tasks;
- using Discord;
- using System.Linq;
- using System.IO;
- using System.Net.Mail;
- using System.Diagnostics;
- using System.Net.Http;
- using System.Xml.Serialization;
- using System.Timers;
- using Google.API;
- using Google.Apis.Translate;
- using Google.API.Translate;
- using Microsoft.CognitiveServices.Speech;
- namespace DiscordBot.Commands
- {
- public class DiscordCommands : ModuleBase<SocketCommandContext>
- {
- public static IUserMessage moonMessage;
- private readonly string _playerDetailsUrl = "http://steamcommunity.com/id/{0}/?xml=1";
- private string username;
- [Command("hello")]
- public async Task HelloAsync()
- {
- await ReplyAsync("Hello there!");
- }
- [Command("miskraam")]
- public async Task MiskraamAsync(IGuildUser user)
- {
- await ReplyAsync($"{user.Mention} miskraam");
- await Task.Delay(450);
- await MiskraamAsync(user);
- }
- [Command("data")]
- public async Task DataAsync()
- {
- Program.prefix = (File.ReadAllText(@"D:\Program Files (x86)\DiscordBot\Prefix.txt"));
- List<string> newCoins = new List<string>();
- newCoins.AddRange(File.ReadLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt"));
- Program.coins = Array.ConvertAll(newCoins.ToArray(), int.Parse).ToList();
- Program.users.AddRange(File.ReadLines(@"D:\Program Files (x86)\DiscordBot\Users.txt"));
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- var strings = (File.ReadLines(@"D:\Program Files (x86)\DiscordBot\TimesLeft.txt"));
- List<DateTime> dates = strings.Select(date => DateTime.Parse(date)).ToList();
- Program.timesLeft.AddRange(dates);
- foreach (string user in Program.users)
- {
- Program.betAmount.Add(50);
- }
- await ReplyAsync($"All data loaded, use prefix `{Program.prefix}` :thumbsup:");
- }
- [Command("say")]
- public async Task SayAsync(string message)
- {
- await Context.Message.DeleteAsync();
- await ReplyAsync(message);
- }
- [Command("moon")]
- public async Task MoonAsync(int times)
- {
- if (times < 5)
- {
- int timesLeft = times;
- timesLeft--;
- IUserMessage message = moonMessage;
- if (message == null)
- {
- message = await Context.Channel.SendMessageAsync(":new_moon:");
- }
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":waning_crescent_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":last_quarter_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":waning_gibbous_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":full_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":waxing_gibbous_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":first_quarter_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":waxing_crescent_moon:");
- await Task.Delay(1000);
- await message.ModifyAsync(msg => msg.Content = ":new_moon:");
- moonMessage = message;
- if (timesLeft > 0)
- {
- await MoonAsync(timesLeft);
- }else
- {
- moonMessage = null;
- }
- }else
- {
- await ReplyAsync("Enter a number under 5");
- }
- }
- [Command("sicko")]
- public async Task Sicko()
- {
- var message = await Context.Channel.SendMessageAsync("https://i.redd.it/e5za9yb75myz.gif");
- }
- [Command("setgame")]
- public async Task HelloAsync(string game)
- {
- await Program.client.SetGameAsync(game);
- await ReplyAsync("Changed game status to `" + game + "` :thumbsup:");
- }
- [Command("freecoins")]
- public async Task FreeCoinsAsync()
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- var timeLeft = (Program.timesLeft[i] - DateTime.Now);
- var hoursLeft = 12 - timeLeft.Hours;
- if (hoursLeft <= 0)
- {
- Program.coins[i] += 500;
- await ReplyAsync($"{Context.User.Mention} You have been given `500 coins` :thumbsup:");
- }
- else if (hoursLeft > 0 && hoursLeft < 1)
- {
- await ReplyAsync($"You need to wait a couple more minutes to do this.");
- }
- else
- {
- await ReplyAsync($"You need to wait {hoursLeft} more hours to do this.");
- }
- }
- [Command("ping")]
- public async Task PingAsync()
- {
- var ping = Program.client.Latency;
- Stopwatch latency = new Stopwatch();
- latency.Start();
- if (ping < 200)
- {
- await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :white_check_mark: ");
- }
- else if (ping < 500)
- {
- await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :ok: ");
- }else if(ping < 1)
- {
- await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :warning:");
- }else
- {
- await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :sos:");
- }
- latency.Stop();
- if (latency.ElapsedMilliseconds < 150)
- {
- await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :white_check_mark: ");
- }
- else if (latency.ElapsedMilliseconds < 250)
- {
- await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :ok: ");
- }
- else if (latency.ElapsedMilliseconds < 350)
- {
- await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :warning:");
- }
- else
- {
- await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :sos:");
- }
- }
- [Command("help"),]
- public async Task HelpAsync()
- {
- await ReplyAsync($"**Prefix** *`{Program.prefix}`* \n \n**Public Commands:** \n *`{Program.prefix}rollunder <2-98>`* Generate a random number, if under the given number, you win coins " +
- $"\n *`{Program.prefix}betamount <amount>`* Sets your bet amount to the given value \n *`{Program.prefix}roulette <color>`* Play roulette and guess the color to win coins \n *`{Program.prefix}suggest <command> <description> `* Suggest a command to the developer \n \n" +
- $"\n **Administrator Commands:** \n *`{Program.prefix}clear <amount>`* Removes the given amount of messages \n *`{Program.prefix}mute <user> <seconds>`* Mutes the user for the given amount of seconds" +
- $"\n *`{Program.prefix}addrole <name> <color>`* Add a role to the server \n *`{Program.prefix}removerole <name> `* Remove a role from the server");
- }
- [Command("steamprofile")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- public async Task SteamProfileAsync(string ID)
- {
- var idarray = ID.Split(":");
- long convertedTo64Bit = System.Convert.ToInt64(idarray[2]) * 2;
- convertedTo64Bit += 76561197960265728;
- convertedTo64Bit += System.Convert.ToInt64(idarray[1]);
- var link = (@"http://steamcommunity.com/profiles/" + convertedTo64Bit);
- await ReplyAsync($"Steam user profile: {link}");
- }
- [Command("steamid64")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- public async Task ID64Async(string ID)
- {
- var idarray = ID.Split(":");
- long convertedTo64Bit = System.Convert.ToInt64(idarray[2]) * 2;
- convertedTo64Bit += 76561197960265728;
- convertedTo64Bit += System.Convert.ToInt64(idarray[1]);
- await ReplyAsync($"Steam user ID64: `{convertedTo64Bit}`");
- }
- private string NormalizeUsername(string name)
- {
- return name.Contains("http://") ? name : string.Format(_playerDetailsUrl, name);
- }
- [Command("clear")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- [RequireUserPermission(GuildPermission.ManageChannels)]
- public async Task DelMesAsync(int delnum)
- {
- var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
- await Context.Channel.DeleteMessagesAsync(items);
- var message = await ReplyAsync("Removed " + delnum.ToString() + " messages <:nyan:510907023928459274>");
- await Task.Delay(5000);
- await message.DeleteAsync();
- }
- [Command("despacito")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- public async Task DespacitoAsync()
- {
- await ReplyAsync("bokito bokito");
- }
- [Command("mute")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task MuteAsync(IGuildUser user, int seconds)
- {
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
- await (user as IGuildUser).AddRoleAsync(role);
- await ReplyAsync("Muted " + user.Mention + " for `" + seconds + " seconds`");
- await Task.Delay(seconds * 1000);
- await (user as IGuildUser).RemoveRoleAsync(role);
- }
- [Command("addrole")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task AddRoleAsync(string name, string color)
- {
- Discord.Color roleColor = new Discord.Color((UInt32)(System.Drawing.Color.FromName(color).ToArgb()));
- if (color == "blue")
- {
- roleColor = Color.Blue;
- }
- else if (color == "red")
- {
- roleColor = Color.Red;
- }
- else if (color == "green")
- {
- roleColor = Color.Green;
- }
- else if (color == "purple")
- {
- roleColor = Color.Purple;
- }
- else if (color == "darkblue")
- {
- roleColor = Color.DarkBlue;
- }
- var role = await Context.Guild.CreateRoleAsync(name, null, roleColor, false, null);
- await ReplyAsync("Added role `" + name + "` to the server :thumbsup:");
- }
- [Command("removerole")]
- [RequireBotPermission(GuildPermission.ManageMessages)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task DeleteRoleAsync(SocketRole role)
- {
- var message = await ReplyAsync(@"\" + role.Mention);
- await message.DeleteAsync();
- string messageText = message.ToString();
- messageText = messageText.Replace("<", "");
- messageText = messageText.Replace(">", "");
- messageText = messageText.Replace("@", "");
- messageText = messageText.Replace("&", "");
- messageText = messageText.Replace(@"\", "");
- ulong ulongID = ulong.Parse(messageText);
- await Context.Guild.GetRole(ulongID).DeleteAsync();
- await ReplyAsync("Removed role `" + Context.Guild.GetRole(ulongID) + "` from the server :thumbsup:");
- }
- [Command("unmute")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task UnmuteAsync(IGuildUser user)
- {
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
- await (user as IGuildUser).RemoveRoleAsync(role);
- await ReplyAsync("Unmuted " + user.Mention);
- }
- [Command("ban")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task BanAsync(IGuildUser user)
- {
- await Context.Guild.AddBanAsync(user);
- }
- [Command("lock")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task LockAsync(IGuildUser user, int seconds)
- {
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "locked");
- await (user as IGuildUser).AddRoleAsync(role);
- await ReplyAsync("Locked " + user.Mention + " for `" + seconds + " seconds`");
- await Task.Delay(seconds * 1000);
- await (user as IGuildUser).RemoveRoleAsync(role);
- }
- [Command("unlock")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task UnlockAsync(IGuildUser user)
- {
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "locked");
- await (user as IGuildUser).RemoveRoleAsync(role);
- await ReplyAsync("Unlocked " + user.Mention);
- }
- [Command("kick")]
- [RequireBotPermission(GuildPermission.KickMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task KickAsync(IGuildUser user)
- {
- await ReplyAsync("Kicked " + user.Mention + " from the server :wave: :thumbsup:");
- await user.KickAsync();
- }
- [Command("suggest")]
- public async Task SuggestAsync(string command, string description)
- {
- SmtpClient client = new SmtpClient();
- client.Port = 587;
- client.Host = "smtp.gmail.com";
- client.EnableSsl = true;
- client.Timeout = 10000;
- client.DeliveryMethod = SmtpDeliveryMethod.Network;
- client.UseDefaultCredentials = false;
- client.Credentials = new System.Net.NetworkCredential("larsvcroonenburg@gmail.com", "Valuegames2002");
- MailMessage mail = new MailMessage("larsvcroonenburg@gmail.com", "larsvcroonenburg@gmail.com", Context.User + " suggested " + command, Context.User + " suggested to add " + command + " with description: " + description);
- mail.BodyEncoding = UTF8Encoding.UTF8;
- mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
- client.Send(mail);
- await ReplyAsync($"{Context.User.Mention} Suggested command `" + command + "` :thumbsup:");
- }
- [Command("rollunder")]
- public async Task RollAsync(int chance)
- {
- if (chance > 1 && chance < 98)
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- Random random = new Random();
- int roll = random.Next(0, 100);
- if (roll < chance && Program.coins[i] >= Program.betAmount[i])
- {
- Program.coins[i] -= Program.betAmount[i];
- await ReplyAsync($"{Context.User.Mention} `-" + Program.betAmount[i].ToString() + "` coins");
- float floatChance = chance * 1.0f;
- float wonCoins = Program.betAmount[i] * (100 / floatChance);
- Program.coins[i] += (int)wonCoins;
- await ReplyAsync($"{Context.User.Mention} It rolled `" + roll.ToString() + "` and you won `" + ((int)wonCoins).ToString() + "` coins :white_check_mark:");
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- }
- else if (Program.coins[i] >= Program.betAmount[i])
- {
- Program.coins[i] -= Program.betAmount[i];
- await ReplyAsync($"{Context.User.Mention} `-" + Program.betAmount[i].ToString() + "` coins");
- await ReplyAsync($"{Context.User.Mention} It rolled `" + roll.ToString() + "` and you lost :x:");
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- }
- else if (Program.coins[i] < Program.betAmount[i])
- {
- await ReplyAsync($"{Context.User.Mention} Not enough coins to do this, change your bet amount with .betamount <number>");
- }
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Enter a valid number between 1 and 98");
- }
- }
- [Command("roulette")]
- public async Task AmountAsync(string color)
- {
- if (color == "red" || color == "blue" || color == "black")
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- Random random = new Random();
- float roll = random.Next(0, 100);
- string rollColor = "color";
- int wonCoins = new int();
- if (roll < 7)
- {
- rollColor = "blue";
- wonCoins = Program.betAmount[i] * 14;
- }
- else if (roll > 7 && roll <= 53.5)
- {
- rollColor = "black";
- wonCoins = Program.betAmount[i] * 2;
- }
- else if (roll > 53.5)
- {
- rollColor = "red";
- wonCoins = Program.betAmount[i] * 2;
- }
- if (Program.coins[i] >= Program.betAmount[i])
- {
- Program.coins[i] -= Program.betAmount[i];
- await ReplyAsync($"{Context.User.Mention} `-" + Program.betAmount[i].ToString() + "` coins");
- if (rollColor == color)
- {
- Program.coins[i] += wonCoins;
- if (rollColor == "red")
- {
- await ReplyAsync($"{Context.User.Mention} It rolled :red_circle: red :red_circle: and you won `" + wonCoins.ToString() + "coins`");
- }
- else if (rollColor == "black")
- {
- await ReplyAsync($"{Context.User.Mention} It rolled :black_circle: black :black_circle: and you won `" + wonCoins.ToString() + "coins`");
- }
- else if (rollColor == "blue")
- {
- await ReplyAsync($"{Context.User.Mention} It rolled :large_blue_circle: blue :large_blue_circle: and you won `" + wonCoins.ToString() + "coins`");
- }
- }
- else
- {
- if (rollColor == "red")
- {
- await ReplyAsync($"{Context.User.Mention} It rolled :red_circle: red :red_circle: and you lost");
- }
- else if (rollColor == "black")
- {
- await ReplyAsync($"{Context.User.Mention} It rolled :black_circle: black :black_circle: and you lost");
- }
- else if (rollColor == "blue")
- {
- await ReplyAsync($"{Context.User.Mention} It rolled :large_blue_circle: blue :large_blue_circle: and you lost");
- }
- }
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- }
- else if (Program.coins[i] < Program.betAmount[i])
- {
- await ReplyAsync($"{Context.User.Mention} Not enough coins to do this, change your bet amount with .betamount <number>");
- }
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Enter a valid color (red (46.5%), black (46.5%), blue(7%))");
- }
- }
- [Command("betamount")]
- public async Task AmountAsync(int amount)
- {
- if (amount > 0)
- {
- if (Program.betAmount.ToArray().Length < Program.users.ToArray().Length)
- {
- Program.betAmount.Add(amount);
- }
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- Program.betAmount[i] = amount;
- await ReplyAsync($"{Context.User.Mention} Bet amount changed to `" + amount.ToString() + "` :thumbsup:");
- }
- else
- {
- await ReplyAsync("Enter a bet amount higher than 0");
- }
- }
- [Command("id")]
- public async Task IDAsync()
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- await ReplyAsync($"{Context.User.Mention} Your user ID is " + i.ToString());
- }
- [Command("add")]
- public async Task AddQAsync(string question)
- {
- Program.questions.Add(question);
- return;
- }
- [Command("coins")]
- public async Task CoinsAsync()
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- await ReplyAsync($"{Context.User.Mention} You have `" + Program.coins[i].ToString() + "` coins");
- }
- [Command("shop")]
- public async Task ShopAsync()
- {
- await ReplyAsync("Roles: \n 1. Special *`2.000 coins`* \n 2. DJ Role *`10.000 coins`* \n 3. Moderator *`50.000 coins`* \n \n Commands: ");
- }
- [Command("buy")]
- public async Task BuyAsync(int id)
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- if (id == 1)
- {
- if (Program.coins[i] >= 2000)
- {
- Program.coins[i] -= 2000;
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Special");
- await (Context.User as IGuildUser).AddRoleAsync(role);
- await ReplyAsync($"{Context.User.Mention} Successfully received role Special for *`2.000 coins`*");
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Not enough coins to buy this");
- }
- }
- else if (id == 2)
- {
- await ReplyAsync($"{Context.User.Mention} This role is not available");
- }
- else if (id == 3)
- {
- await ReplyAsync($"{Context.User.Mention} This role is not available");
- }
- }
- [Command("createuser")]
- public async Task GiveCoinsAsync()
- {
- if (!Program.users.Contains(Context.User.ToString()))
- {
- Program.users.Add(Context.User.ToString());
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Users.txt", Program.users.ToArray());
- Program.coins.Add(500);
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- Program.betAmount.Add(50);
- Program.timesLeft.Add(DateTime.Now);
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\TimesLeft.txt", Program.timesLeft.Select(x => x.ToString()).ToArray());
- await ReplyAsync($"{Context.User.Mention} User created and you received `500 coins` :thumbsup:");
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} You are already registered as user");
- }
- }
- [Command("givecoins")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task GiveCoinsAsync(SocketGuildUser user, int amount)
- {
- int i = Array.IndexOf(Program.users.ToArray(), user.ToString());
- Program.coins[i] += amount;
- await ReplyAsync($"{user.Mention} has been given `" + amount.ToString() + " coins`");
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- }
- [Command("give")]
- public async Task GiveAsync(SocketGuildUser user, int amount)
- {
- int e = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- Program.coins[e] -= amount;
- int i = Array.IndexOf(Program.users.ToArray(), user.ToString());
- Program.coins[i] += amount;
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- await ReplyAsync($"{Context.User.Mention} has given `" + amount.ToString() + " coins` to " + user.Mention);
- }
- [Command("coinflip")]
- public async Task CoinFlipAsync(int amount)
- {
- int i = Array.IndexOf(Program.users.ToArray(), Context.User.ToString());
- if (Program.coins[i] >= Program.flipAmount && Program.flipAmount > 0 || Program.coins[i] >= amount && Program.flipAmount == 0)
- {
- if (!Program.coinFlipUsers.Contains(Context.User.ToString()))
- {
- if (Program.coinFlip <= 2)
- {
- if (amount == Program.flipAmount && Program.coinFlip > 0 || Program.coinFlip == 0 && amount > 0)
- {
- Program.flipAmount = amount;
- Program.coins[i] -= amount;
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- Program.coinFlip++;
- Program.coinFlipUsers.Add(Context.User.ToString());
- await ReplyAsync($"{Context.User.Mention} has joined the coinflip with `" + amount.ToString() + " coins` (" + Program.coinFlip.ToString() + "/2)");
- if (Program.coinFlip == 2)
- {
- Random random = new Random();
- float roll = random.Next(0, 100);
- if (roll < 50)
- {
- int w = Array.IndexOf(Program.users.ToArray(), Program.coinFlipUsers[0]);
- Program.coins[w] += Program.flipAmount * 2;
- await ReplyAsync($"{Program.coinFlipUsers[0]} has won the coinflip and won `" + Program.flipAmount.ToString() + " coins`");
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- }
- else
- {
- int w = Array.IndexOf(Program.users.ToArray(), Program.coinFlipUsers[1]);
- Program.coins[w] += Program.flipAmount * 2;
- await ReplyAsync($"{Program.coinFlipUsers[1]} has won the coinflip and won `" + Program.flipAmount.ToString() + " coins`");
- File.WriteAllLines(@"D:\Program Files (x86)\DiscordBot\Coins.txt", Program.coins.Select(x => x.ToString()).ToArray());
- }
- Program.coinFlipUsers.Clear();
- Program.flipAmount = 0;
- Program.coinFlip = 0;
- }
- }
- else if (amount != Program.flipAmount && Program.coinFlip > 0)
- {
- await ReplyAsync($"{Context.User.Mention} Enter the coinflip with the same amount");
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Enter a number greater than 0");
- }
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Wait for the next coinflip");
- }
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} You already joined the coinflip");
- }
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Not enough coins");
- }
- }
- [Command("stink")]
- public async Task StinkAsync(SocketGuildUser user)
- {
- await ReplyAsync($"{user.Mention} is een stink joch");
- }
- [Command("prefix")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task StinkAsync(string prefix)
- {
- await ReplyAsync($"Prefix changed to `{prefix}`");
- Program.prefix = prefix;
- File.WriteAllText(@"D:\Program Files (x86)\DiscordBot\Prefix.txt", prefix);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement