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 System.Net;
- using System.Web;
- namespace DiscordBot.Commands
- {
- public class DiscordCommands : ModuleBase<SocketCommandContext>
- {
- private string[] facts = { "fact one", "fact two", "fact three", "fact four" };
- [Command("hello"), Alias("hi", "hey", "yo")]
- public async Task HelloAsync()
- {
- await ReplyAsync("Hello there! <:NicoSalute:513447702412132389>");
- }
- [Command("ping"), Alias("latency")]
- public async Task PingAsync()
- {
- var ping = Program.client.Latency;
- Stopwatch latency = new Stopwatch();
- latency.Start();
- if (ping < 250)
- {
- 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 < 1000)
- {
- 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 < 250)
- {
- await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :white_check_mark: ");
- }
- else if (latency.ElapsedMilliseconds < 750)
- {
- await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :ok: ");
- }
- else if (latency.ElapsedMilliseconds < 1000)
- {
- 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}avatar [user]`* Gets the avatar of the given user \n *`{Program.prefix}tiktokrandom`* Sends a random tiktok \n *`{Program.prefix}tiktok`* Information about Kat's tiktok");
- }
- [Command("modhelp")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task ModHelpAsync()
- {
- await ReplyAsync($"**Prefix:** `{Program.prefix}`\n \n**Moderation Commands:** \n \n __General commands:__ \n *`{Program.prefix}clear [amount]`* Removes the given amount of messages \n *`{Program.prefix}filter [amount]`* Checks for an amount of inappropriate messages and removes them \n *`{Program.prefix}mute [user] `* Mutes the given user" +
- $"\n *`{Program.prefix}unmute [user]`* Unmutes the user \n" +
- $"*`{Program.prefix}kick [user]`* Kicks the given user \n *`{Program.prefix}ban [user]`* Bans the given user \n *`{Program.prefix}allowpings [false/true]`* Enable or disable the removal of kat pings \n \n__Watchlist commands:__ \n*`{Program.prefix}wl`* Shows the current users on the watchlist \n *`{Program.prefix}wl [add/remove] [user] [description]`* Adds or remove a user from/to the watchlist \n *`{Program.prefix}user [user]`* Shows information about the user");
- }
- [Command("clear")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- 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 <:huh:514118688086032414>");
- await Task.Delay(5000);
- await message.DeleteAsync();
- }
- [Command("purgelinks")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task DelLinksAsync(int delnum)
- {
- await Context.Message.DeleteAsync();
- var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
- int i = 0;
- foreach (IMessage message in items)
- {
- if (message.Content.Contains("https://") || message.Content.Contains(".com") || message.Content.Contains("http://") || message.Content.Contains("www."))
- {
- await message.DeleteAsync();
- i++;
- }
- }
- var msg = await ReplyAsync("Removed **" + i + "** links :white_check_mark:");
- await Task.Delay(3000);
- await msg.DeleteAsync();
- }
- [Command("filter")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task FilterAsync(int delnum)
- {
- await Context.Message.DeleteAsync();
- var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
- var a = items.ToList();
- int i = 0;
- var containsbadword = false;
- foreach (IMessage message in items)
- {
- foreach (string bannedWord in Program.bannedWords)
- {
- var bypass2 = message.Content.ToLower().Replace(" ", "");
- var bypass = message.Content.ToLower().Replace("е", "e").Replace("о", "o").Replace("в", "b").Replace("т", "t").Replace("а", "a").Replace("о", "o").Replace("4", "a").Replace("3", "e").Replace("!", "i").Replace("1", "i").Replace("0", "o");
- var bypass4 = bypass.Replace("'s", " is");
- var bypass3 = bypass.Replace(" ", "");
- var bypass5 = bypass.Replace("aaaaa", "a").Replace("aaaa", "a").Replace("aaa", "a").Replace("aa", "a").Replace("ooooo", "o").Replace("oooo", "o").Replace("ooo", "o").Replace("oo", "o").Replace("ii", "i").Replace("yy", "y");
- var bypass6 = bypass.Replace("*", "");
- if (!message.Content.ToLower().Contains(bannedWord) && !bypass.Contains(bannedWord))
- {
- containsbadword = false;
- }
- else
- {
- containsbadword = true;
- break;
- }
- }
- if (containsbadword)
- {
- i++;
- Console.WriteLine(message.Content);
- } else
- {
- a.Remove(message);
- }
- }
- await Context.Channel.DeleteMessagesAsync(a);
- var msg = await ReplyAsync("Removed **" + i + "** inappropriate messages :white_check_mark:");
- await Task.Delay(3000);
- await msg.DeleteAsync();
- }
- [Command("check")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task CheckAsync(int delnum, ulong id)
- {
- Console.WriteLine("Beginning check...");
- var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
- await Task.Delay(1000);
- var message = await ReplyAsync($"Checking messages...");
- float number = 0;
- List<string> messages = new List<string>();
- foreach (IMessage item in items)
- {
- if (item.Author.Id == id)
- {
- number++;
- float x = number / (delnum + 1) * 100.0f;
- var percentage = (int)(number / (delnum + 1) * 100.0f);
- foreach (string bannedWord in Program.bannedWords)
- {
- var a = $"{item.Author} Link: https://discordapp.com/channels/513087151563341825/{item.Channel.Id}/{item.Id}";
- if (item.Content.ToLower().Contains(bannedWord))
- {
- if (!messages.Contains(a))
- {
- Console.WriteLine($"{a} ({bannedWord})");
- messages.Add(a);
- }
- }
- }
- }
- }
- await message.ModifyAsync(msg => msg.Content = $"Checked all messages! (result in console)");
- Console.WriteLine("Completed!");
- }
- [Command("getmessages")]
- [RequireUserPermission(GuildPermission.ManageNicknames)]
- public async Task GetMessagesAsync(int delnum, ulong id)
- {
- Console.WriteLine("Beginning check...");
- var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
- await Task.Delay(1000);
- var message = await ReplyAsync($"Checking messages...");
- float number = 0;
- List<string> messages = new List<string>();
- foreach (IMessage item in items)
- {
- if (item.Author.Id == id)
- {
- number++;
- float x = number / (delnum + 1) * 100.0f;
- var percentage = (int)(number / (delnum + 1) * 100.0f);
- var a = $@"ID: {item.Id} Link: https://discordapp.com/channels/513087151563341825/{item.Channel.Id}/{item.Id}";
- if (!messages.Contains(a))
- {
- Console.WriteLine(a);
- messages.Add(a);
- }
- }
- }
- await message.ModifyAsync(msg => msg.Content = $"Checked all messages! (result in console)");
- Console.WriteLine("Completed!");
- }
- [Command("discorduser")]
- [RequireUserPermission(GuildPermission.ManageNicknames)]
- public async Task GetDiscordUser(ulong id)
- {
- var user = Program.client.GetUser(id);
- var builder = new EmbedBuilder();
- builder.WithTitle(user.Username);
- builder.WithAuthor(user);
- var date = user.CreatedAt.ToString().Split(' ');
- builder.WithDescription($"**Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago))");
- builder.WithFooter($"ID: {user.Id}");
- await ReplyAsync("", false, builder);
- }
- [Command("check")]
- [RequireUserPermission(GuildPermission.ManageNicknames)]
- public async Task CheckAsync(int delnum)
- {
- Console.WriteLine("Beginning check...");
- var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
- await Task.Delay(1000);
- var message = await ReplyAsync($"Checking messages...");
- float number = 0;
- List<string> messages = new List<string>();
- foreach (IMessage item in items)
- {
- number++;
- float x = number / (delnum + 1) * 100.0f;
- var percentage = (int)(number / (delnum + 1) * 100.0f);
- foreach (string bannedWord in Program.bannedWords)
- {
- var a = $"{item.Author} Link: https://discordapp.com/channels/513087151563341825/{item.Channel.Id}/{item.Id}";
- if (item.Content.ToLower().Contains(bannedWord))
- {
- if (!messages.Contains(a))
- {
- Console.WriteLine($"{a} ({bannedWord})");
- messages.Add(a);
- }
- }
- }
- }
- await message.ModifyAsync(msg => msg.Content = $"Checked all messages! (result in console)");
- Console.WriteLine("Completed!");
- }
- [Command("watchlist"), Alias("wl")]
- [RequireUserPermission(GuildPermission.ManageNicknames)]
- public async Task WatchAsync(string parameter, IGuildUser user, [Remainder]string description = "")
- {
- var id = user.Id.ToString();
- var watchlist = Program.watchlistUsers;
- if (parameter == "add")
- {
- if (!watchlist.Contains(id))
- {
- watchlist.Add(id);
- Program.watchlistTimes.Add(DateTime.Now);
- int index = Array.IndexOf(watchlist.ToArray(), id);
- if (description != "")
- {
- Program.descriptions.Add(description);
- }
- else
- {
- Program.descriptions.Add("none");
- }
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\users.txt", watchlist);
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\descriptions.txt", Program.descriptions);
- List<string> watchTimes = new List<string>();
- foreach (DateTime time in Program.watchlistTimes)
- {
- watchTimes.Add(time.ToString());
- }
- File.WriteAllLines($@"C:\Users\{Program.user}\times.txt", watchTimes);
- await ReplyAsync($"Added user **{user}** to the watchlist :eyes:");
- }
- else
- {
- await ReplyAsync($"User **{user}** is already on the watchlist :x:");
- }
- }
- else if (parameter == "remove" || parameter == "delete" || parameter == "del")
- {
- int index = Array.IndexOf(Program.watchlistUsers.ToArray(), id);
- Program.watchlistTimes.Remove(Program.watchlistTimes[index]);
- watchlist.Remove(id);
- Program.descriptions.Remove(Program.descriptions[index]);
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\users.txt", watchlist);
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\descriptions.txt", Program.descriptions);
- await ReplyAsync($"Removed **{user}** from the watchlist :white_check_mark:");
- }
- else
- {
- await Context.Channel.SendMessageAsync($"Too few parameters, the correct usage is **{Program.prefix}wl add <user> <description>** or **{Program.prefix}wl remove <user>**");
- }
- }
- [Command("user"), Alias("wl")]
- [RequireUserPermission(GuildPermission.ManageNicknames)]
- public async Task WatchListUserAsync(IGuildUser user)
- {
- var id = user.Id.ToString();
- var watchlist = Program.watchlistUsers;
- var builder = new EmbedBuilder();
- builder.WithTitle(user.Username);
- builder.WithAuthor(user);
- var date = user.CreatedAt.ToString().Split(' ');
- var joindate = user.JoinedAt.ToString().Split(' ');
- builder.WithDescription($"**Not on the watchlist ❌** \n **Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago) \n **Joined at:** {joindate[0]} ({(DateTime.Now - DateTime.Parse(joindate[0])).Days} days ago)");
- builder.WithFooter($"ID: {user.Id}");
- if (Program.watchlistUsers.Contains(id.ToString()))
- {
- int index = Array.IndexOf(Program.watchlistUsers.ToArray(), id);
- var timeNow = Program.watchlistTimes.ToArray()[index];
- var time = (DateTime.Now - timeNow);
- var days = time.Days;
- var hours = time.Hours;
- var minutes = time.Minutes;
- var seconds = time.Seconds;
- var description = Program.descriptions[index];
- if (days > 0)
- {
- builder.WithDescription($"**On the watchlist ✅** \n **Description:** {description} \n Last seen {days} days {hours} hours and {minutes} minutes ago \n \n **Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago) \n **Joined at:** {joindate[0]} ({(DateTime.Now - DateTime.Parse(joindate[0])).Days} days ago)");
- }
- else if (hours > 0)
- {
- builder.WithDescription($"**On the watchlist ✅** \n **Description:** {description} \n Last seen {hours} hours and {minutes} minutes ago \n \n **Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago) \n **Joined at:** {joindate[0]} ({(DateTime.Now - DateTime.Parse(joindate[0])).Days} days ago)");
- }
- else if (minutes > 0)
- {
- builder.WithDescription($"**On the watchlist ✅** \n **Description:** {description} \n Last seen {minutes} minutes ago \n \n **Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago) \n **Joined at:** {joindate[0]} ({(DateTime.Now - DateTime.Parse(joindate[0])).Days} days ago)");
- } else
- {
- builder.WithDescription($"**On the watchlist ✅** \n **Description:** {description} \n Last seen {seconds} seconds ago \n \n **Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago) \n **Joined at:** {joindate[0]} ({(DateTime.Now - DateTime.Parse(joindate[0])).Days} days ago)");
- }
- }
- await ReplyAsync("", false, builder);
- }
- /* [Command("lockdown")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task LockdownAsync(string parameter)
- {
- var channels = Context.Guild.TextChannels;
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "@everyone");
- var muterole = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
- var muted = muterole.Permissions;
- IUserMessage message = null;
- if (parameter == "remove" || parameter == "cancel" || parameter == "open" || parameter == "undo")
- {
- message = await ReplyAsync($"Unlocking all channels...🔒");
- foreach (IGuildChannel txt in channels)
- {
- var none = OverwritePermissions.InheritAll;
- await txt.AddPermissionOverwriteAsync(role, none, null);
- }
- await role.ModifyAsync(x =>
- {
- x.Permissions = muted;
- });
- await message.ModifyAsync(msg => msg.Content = $"All channels are now unlocked and everyone is able to send messages again 🔓 ");
- }
- else
- {
- message = await ReplyAsync($"Locking all channels... 🔓 ");
- foreach (IGuildChannel txt in channels)
- {
- var none = OverwritePermissions.DenyAll(txt);
- await txt.AddPermissionOverwriteAsync(role, none, null);
- }
- await role.ModifyAsync(x =>
- {
- x.Permissions = muted;
- });
- await message.ModifyAsync(msg => msg.Content = $"Members without role are now unable to see and send messages in any channel. 🔒");
- }
- } */
- [Command("watchlist"), Alias("wl")]
- [RequireUserPermission(GuildPermission.ManageNicknames)]
- public async Task WatchListAsync()
- {
- var watchlist = Program.watchlistUsers;
- var builder = new EmbedBuilder();
- builder.WithTitle("Users on watch list");
- builder.WithAuthor(Program.client.CurrentUser);
- builder.WithThumbnailUrl(@"http://rxview.adverahealth.com/hubfs/FDA%20Releases%20Q1%202017%20Drug%20Safety%20Watchlist.png");
- foreach (string user in watchlist)
- {
- int index = Array.IndexOf(Program.watchlistUsers.ToArray(), user);
- var timeNow = Program.watchlistTimes.ToArray()[index];
- var description = Program.descriptions.ToArray()[index];
- var time = (DateTime.Now - timeNow);
- var days = time.Days;
- var hours = time.Hours;
- var minutes = time.Minutes;
- var seconds = time.Seconds;
- if (days > 0)
- {
- builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {days} days {hours} hours and {minutes} minutes ago");
- }
- else if (hours > 0)
- {
- builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {hours} hours and {minutes} minutes ago");
- }
- else if (minutes > 0)
- {
- builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {minutes} minutes ago");
- }
- else
- {
- builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {seconds} seconds ago");
- }
- }
- await ReplyAsync("", false, builder);
- }
- [Command("mute")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task MuteAsync(IGuildUser user)
- {
- var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
- await (user as IGuildUser).AddRoleAsync(role);
- await ReplyAsync("*Muted** " + user + "** indefinitely* ✅");
- }
- [Command("unmute")]
- [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 + "*** ✅");
- }
- [Command("removepings")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task PingAsync(bool remove)
- {
- await ReplyAsync("Remove pings is now set to ``" + remove + "``");
- Program.allowPings = !remove;
- }
- [Command("tiktok")]
- public async Task TikTok(string video)
- {
- await Context.Message.DeleteAsync();
- await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\NyanBot\{video}.mp4");
- }
- [Command("tiktoklist"), Alias("tiktoks")]
- public async Task TikTokList()
- {
- var builder = new EmbedBuilder();
- builder.WithTitle("All TikToks");
- builder.WithAuthor(Program.client.CurrentUser);
- builder.AddInlineField("__**Nico Yazawa**__", "hitormiss \n soda \n dame");
- builder.AddInlineField("__**Katia (OC)**__", "hitormiss2 \n startafight \n sandman \n vexing \n smileteeth");
- builder.AddInlineField("__**Momo (OC)**__", "hitormiss \n soda \n dame");
- builder.AddInlineField("__**Yuno Gasai**__", "yunodraft \n sociopath \n dontkillme \n friends \n vanilla");
- builder.AddInlineField("__**Toga**__", "senpai \n neck \n oneyoulove \n whatsthatspell \n");
- builder.AddInlineField("__**Rin Kagamine**__", "imsorry \n \n");
- builder.AddInlineField("__**Zero Two**__", "bullseye \n unconditionally \n mamatoldme \n nobodylikesme");
- builder.AddInlineField("__**Monika**__", "hitormiss3 \n monika \n");
- builder.AddInlineField("__**No Cosplay**__", "million");
- await ReplyAsync("", false, builder);
- }
- [Command("antiswear")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task BadWord(int level)
- {
- await Context.Message.DeleteAsync();
- Program.swearLevel = level;
- await ReplyAsync($"Anti-swear level set to **{level}: {Program.swearLevels[level - 1]}**");
- }
- [Command("addbadword")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task BadWord(string word)
- {
- await Context.Message.DeleteAsync();
- await ReplyAsync($"Added `{word}` to banned words");
- Program.bannedWords.Add(word);
- }
- [Command("removebadword")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task RemoveBadWord(string word)
- {
- await Context.Message.DeleteAsync();
- await ReplyAsync($"Removed `{word}` from banned words");
- Program.bannedWords.Remove(word);
- }
- [Command("avatar"), Alias("av")]
- public async Task PingAsync(SocketGuildUser user)
- {
- var embed = new EmbedBuilder();
- embed.WithAuthor(user);
- embed.WithDescription("**Avatar**");
- embed.WithImageUrl(user.GetAvatarUrl());
- embed.WithColor(Discord.Color.DarkGrey);
- await ReplyAsync("", false, embed);
- }
- [Command("testnewtiktok")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task TFNgAsync(SocketGuildUser user)
- {
- var embed = new EmbedBuilder();
- embed.WithTitle("**Nyannyancosplay TikTok**");
- embed.WithColor(Discord.Color.DarkerGrey);
- embed.WithDescription("*20 year old cosplayer Tag: #nyarmy💛 ♑️ | Hufflepuff | GIRL Spread Love* \n \n" + $"**Nyannyancosplay just uploaded a new TikTok!💛**");
- await Program.client.GetGuild(513087151563341825).GetTextChannel(578328255661342745).SendMessageAsync("@everyone", false, embed);
- }
- [Command("speak")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task bAsync(string a)
- {
- await Program.client.GetGuild(513087151563341825).GetTextChannel(513087151563341827).SendMessageAsync(a);
- }
- [Command("tiktok"), Alias("kat")]
- public async Task Refresh()
- {
- using (WebClient client = new WebClient())
- {
- client.Headers["User-Agent"] = "C# TikTok";
- string followers = "";
- string following = "";
- string avatarUrl = "";
- string hearts = "";
- string videos = "";
- var htmlCode = Program.htmlCode;
- int Start, End;
- int Start2, End2;
- int Start3, End3;
- int Start4, End4;
- int Start5, End5;
- string strStart = "wing</span></p>";
- string strEnd = "k";
- string strStart2 = "<strong class=";
- string strEnd2 = "<";
- string strStart3 = "avatar_larger";
- string strEnd3 = ",";
- string strStart4 = "Followers</span>";
- string strEnd4 = "m<";
- string strStart5 = "heart";
- string strEnd5 = @",""verified""";
- if (htmlCode.Contains(strStart) && htmlCode.Contains(strEnd))
- {
- Start = htmlCode.IndexOf(strStart, 0) + strStart.Length;
- End = htmlCode.IndexOf(strEnd, Start);
- followers = htmlCode.Substring(Start, End - Start).Substring(42);
- }
- if (htmlCode.Contains(strStart2) && htmlCode.Contains(strEnd2))
- {
- Start2 = htmlCode.IndexOf(strStart2, 0) + strStart2.Length;
- End2 = htmlCode.IndexOf(strEnd2, Start2);
- following = htmlCode.Substring(Start2, End2 - Start2).Substring(9);
- following = following.Substring(0, following.Length);
- }
- if (htmlCode.Contains(strStart3) && htmlCode.Contains(strEnd3))
- {
- Start3 = htmlCode.IndexOf(strStart3, 0) + strStart3.Length;
- End3 = htmlCode.IndexOf(strEnd3, Start3);
- avatarUrl = htmlCode.Substring(Start3, End3 - Start3).Substring(20);
- avatarUrl = avatarUrl.Substring(0, avatarUrl.Length - 1);
- avatarUrl = "http://" + avatarUrl;
- }
- if (htmlCode.Contains(strStart4) && htmlCode.Contains(strEnd4))
- {
- Start4 = htmlCode.IndexOf(strStart4, 0) + strStart4.Length;
- End4 = htmlCode.IndexOf(strEnd4, Start4);
- hearts = htmlCode.Substring(Start4, End4 - Start4).Substring(72);
- }
- if (htmlCode.Contains(strStart5) && htmlCode.Contains(strEnd5))
- {
- Start5 = htmlCode.IndexOf(strStart5, 0) + strStart5.Length;
- End5 = htmlCode.IndexOf(strEnd5, Start5);
- videos = htmlCode.Substring(Start5, End5 - Start5).Substring(18);
- }
- var embed = new EmbedBuilder();
- embed.WithTitle("**Nyannyancosplay TikTok**");
- embed.WithColor(Discord.Color.DarkerGrey);
- embed.WithDescription("*20 year old cosplayer Tag: #nyarmy💛 ♑️ | Hufflepuff | GIRL Spread Love* \n" + "**Following: " + following + "\n" + followers + "k followers \n" + hearts + $"m hearts💛 \n {videos} TikToks**");
- embed.WithThumbnailUrl("https://m-p16.akamaized.net/img/musically-maliva-obj/1619974882678790~c5_720x720.jpeg");
- await ReplyAsync("", false, embed);
- }
- }
- [Command("rule")]
- public async Task Rule(int rule)
- {
- await Context.Channel.SendMessageAsync($"```{Program.rules[rule - 1]}```");
- }
- [Command("tiktokrandom"), Alias("randomtiktok")]
- public async Task TikTokRandom()
- {
- var user = Context.User.Id.ToString();
- if (!Program.cooldownUsers.Contains(user))
- {
- Program.cooldownUsers.Add(user);
- Program.cooldowns.Add(DateTime.Now.AddMinutes(-1));
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
- List<string> cooldowns = new List<string>();
- foreach (DateTime time in Program.cooldowns)
- {
- cooldowns.Add(time.ToString());
- }
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
- }
- var index = Program.cooldownUsers.FindIndex(x => x.Equals(Context.User.Id.ToString()));
- var OG = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "OG");
- var Trusted = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Trusted");
- var Active = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Active");
- if (Context.Channel == Context.Channel)
- {
- await Context.Channel.TriggerTypingAsync();
- Random rnd = new Random();
- int number = rnd.Next(1, Program.tiktoks);
- if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 5 && File.Exists($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4"))
- {
- if (number == 126)
- {
- await Context.Channel.SendFileAsync($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4", "You rolled **Hit or miss** <:Huh_2: 514118688086032414>");
- }
- else
- {
- await Context.Channel.SendFileAsync($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4");
- }
- Program.cooldowns[index] = DateTime.Now;
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
- List<string> cooldowns = new List<string>();
- foreach (DateTime time in Program.cooldowns)
- {
- cooldowns.Add(time.ToString());
- }
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
- }
- else if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 5 && !File.Exists($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4"))
- {
- await ReplyAsync($"{Context.User.Mention} Failed to send file. Please try again.");
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Please wait another {(int)(5 - (DateTime.Now - Program.cooldowns[index]).TotalSeconds)} seconds.");
- }
- }
- }
- [Command("tiktokboom"), Alias("tiktikboom")]
- public async Task TikTokBoom()
- {
- if (!Program.isSending)
- {
- List<int> prevTikToks = new List<int>();
- var ModJr = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Mod Jr");
- var Mod = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Moderator");
- if ((Context.User as SocketGuildUser).Roles.Contains(ModJr) || (Context.User as SocketGuildUser).Roles.Contains(Mod))
- {
- for (int i = 0; i < 5; ++i)
- {
- Random rnd = new Random();
- int number = rnd.Next(1, 201);
- if (File.Exists($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4") && !prevTikToks.Contains(number))
- {
- await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4");
- prevTikToks.Add(number);
- }
- else
- {
- Random rnd1 = new Random();
- int number1 = rnd.Next(1, 201);
- await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number1}.mp4");
- }
- if (i >= 4)
- {
- prevTikToks.Clear();
- }
- }
- }
- Program.isSending = true;
- }
- }
- [Command("tiktokbet"), Alias("tiktikbet")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task TikTokBet([Remainder]string cosp)
- {
- var user = Context.User.Id.ToString();
- if (!Program.cooldownUsers.Contains(user))
- {
- Program.cooldownUsers.Add(user);
- Program.cooldowns.Add(DateTime.Now.AddMinutes(-1));
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
- List<string> cooldowns = new List<string>();
- foreach (DateTime time in Program.cooldowns)
- {
- cooldowns.Add(time.ToString());
- }
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
- }
- var index = Program.cooldownUsers.FindIndex(x => x.Equals(Context.User.Id.ToString()));
- var OG = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "OG");
- var Trusted = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Trusted");
- var Active = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Active");
- if (Context.Channel == Context.Channel)
- {
- if ((Context.User as SocketGuildUser).Roles.Contains(OG) || (Context.User as SocketGuildUser).Roles.Contains(Trusted) || (Context.User as SocketGuildUser).Roles.Contains(Active))
- {
- await Context.Channel.TriggerTypingAsync();
- Random rnd = new Random();
- int number = rnd.Next(1, 201);
- if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 0 && File.Exists($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4"))
- {
- if (cosp == "Rin Kagamine" && Program.Rin.Contains(number) || cosp == "OOC" && Program.OOC.Contains(number) || cosp == "No cosplay" && Program.OOC.Contains(number) || cosp == "02" && Program.O2.Contains(number) || cosp == "Nico" && Program.Nico.Contains(number))
- {
- await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4", $"{Context.User.Mention} You guessed it correctly **+5 credits**");
- }
- else
- {
- await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4", "Wrong **-5 credits**");
- }
- Program.cooldowns[index] = DateTime.Now;
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
- List<string> cooldowns = new List<string>();
- foreach (DateTime time in Program.cooldowns)
- {
- cooldowns.Add(time.ToString());
- }
- File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
- }
- else if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 0 && !File.Exists($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4"))
- {
- await ReplyAsync($"{Context.User.Mention} Failed to send file. Please try again.");
- }
- else
- {
- await ReplyAsync($"{Context.User.Mention} Please wait another {(int)(15 - (DateTime.Now - Program.cooldowns[index]).TotalSeconds)} seconds.");
- }
- }
- }
- }
- [Command("chances")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task ChancesAsync()
- {
- int totalLength = Program.OOC.ToArray().Length + Program.Rin.ToArray().Length + Program.Nico.ToArray().Length + Program.O2.ToArray().Length;
- double chanceRin = ((double)Program.Rin.ToArray().Length) / totalLength;
- double chanceOOC = ((double)Program.OOC.ToArray().Length) / totalLength;
- double chanceNico = ((double)Program.Nico.ToArray().Length) / totalLength;
- double chance02 = ((double)Program.O2.ToArray().Length) / totalLength;
- double chanceYuno = ((double)Program.OOC.ToArray().Length) / totalLength;
- double chanceKeiko = ((double)Program.OOC.ToArray().Length) / totalLength;
- var builder = new EmbedBuilder();
- builder.WithTitle("Roll chances");
- builder.WithAuthor(Program.client.CurrentUser);
- builder.AddField($"**OOC:**", $"{(int)(chanceOOC * 100)}%");
- builder.AddField($"**Rin Kagamine:**", $"{(int)(chanceRin * 100)}%");
- builder.AddField($"**Nico Yazawa:**", $"{(int)(chanceNico * 100)}%");
- builder.AddField($"**Zero Two:**", $"{(int)(chance02 * 100)}%");
- await ReplyAsync("", false, builder);
- }
- [Command("ban")]
- [RequireBotPermission(GuildPermission.BanMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task BanAsync(IGuildUser user)
- {
- await ReplyAsync("Banned **" + user + "** from the server ✅");
- await Context.Guild.AddBanAsync(user);
- }
- [Command("kick")]
- [RequireBotPermission(GuildPermission.KickMembers)]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task KickAsync(IGuildUser user)
- {
- await ReplyAsync("*Kicked **" + user + "** from the server* ✅");
- await user.KickAsync();
- }
- [Command("prefix")]
- [RequireUserPermission(GuildPermission.BanMembers)]
- public async Task StinkAsync(string prefix)
- {
- await ReplyAsync($"Prefix changed to `{prefix}`");
- Program.prefix = prefix;
- File.WriteAllText($@"C:\Users\{Program.user}\Desktop\prefix.txt", prefix);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement