Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Discord.Commands;
  5. using Discord.WebSocket;
  6. using System.Threading.Tasks;
  7. using Discord;
  8. using System.Linq;
  9. using System.IO;
  10. using System.Net.Mail;
  11. using System.Diagnostics;
  12. using System.Net.Http;
  13. using System.Xml.Serialization;
  14. using System.Timers;
  15. using System.Net;
  16. using System.Web;
  17.  
  18. namespace DiscordBot.Commands
  19. {
  20.  
  21. public class DiscordCommands : ModuleBase<SocketCommandContext>
  22. {
  23.  
  24. private string[] facts = { "fact one", "fact two", "fact three", "fact four" };
  25.  
  26. [Command("hello"), Alias("hi", "hey", "yo")]
  27. public async Task HelloAsync()
  28. {
  29. await ReplyAsync("Hello there! <:NicoSalute:513447702412132389>");
  30. }
  31.  
  32. [Command("ping"), Alias("latency")]
  33. public async Task PingAsync()
  34. {
  35. var ping = Program.client.Latency;
  36.  
  37. Stopwatch latency = new Stopwatch();
  38. latency.Start();
  39.  
  40. if (ping < 250)
  41. {
  42. await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :white_check_mark: ");
  43. }
  44. else if (ping < 500)
  45. {
  46. await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :ok: ");
  47. }
  48. else if (ping < 1000)
  49. {
  50. await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :warning:");
  51. }
  52. else
  53. {
  54. await ReplyAsync($"My current latency with the gateway server is `{Program.client.Latency}` :sos:");
  55. }
  56.  
  57. latency.Stop();
  58.  
  59. if (latency.ElapsedMilliseconds < 250)
  60. {
  61. await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :white_check_mark: ");
  62. }
  63. else if (latency.ElapsedMilliseconds < 750)
  64. {
  65. await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :ok: ");
  66. }
  67. else if (latency.ElapsedMilliseconds < 1000)
  68. {
  69. await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :warning:");
  70. }
  71. else
  72. {
  73. await ReplyAsync($"Script latency of `{latency.ElapsedMilliseconds}` :sos:");
  74. }
  75. }
  76.  
  77.  
  78. [Command("help")]
  79. public async Task HelpAsync()
  80. {
  81. 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");
  82. }
  83.  
  84. [Command("modhelp")]
  85. [RequireUserPermission(GuildPermission.BanMembers)]
  86. public async Task ModHelpAsync()
  87. {
  88. 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" +
  89. $"\n *`{Program.prefix}unmute [user]`* Unmutes the user \n" +
  90. $"*`{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");
  91. }
  92.  
  93. [Command("clear")]
  94. [RequireUserPermission(GuildPermission.BanMembers)]
  95. public async Task DelMesAsync(int delnum)
  96. {
  97. var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
  98. await Context.Channel.DeleteMessagesAsync(items);
  99. var message = await ReplyAsync("Removed " + delnum.ToString() + " messages <:huh:514118688086032414>");
  100. await Task.Delay(5000);
  101. await message.DeleteAsync();
  102. }
  103.  
  104. [Command("purgelinks")]
  105. [RequireUserPermission(GuildPermission.BanMembers)]
  106. public async Task DelLinksAsync(int delnum)
  107. {
  108. await Context.Message.DeleteAsync();
  109. var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
  110. int i = 0;
  111. foreach (IMessage message in items)
  112. {
  113. if (message.Content.Contains("https://") || message.Content.Contains(".com") || message.Content.Contains("http://") || message.Content.Contains("www."))
  114. {
  115. await message.DeleteAsync();
  116. i++;
  117. }
  118. }
  119. var msg = await ReplyAsync("Removed **" + i + "** links :white_check_mark:");
  120. await Task.Delay(3000);
  121. await msg.DeleteAsync();
  122. }
  123.  
  124. [Command("filter")]
  125. [RequireUserPermission(GuildPermission.BanMembers)]
  126. public async Task FilterAsync(int delnum)
  127. {
  128. await Context.Message.DeleteAsync();
  129. var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
  130. var a = items.ToList();
  131. int i = 0;
  132. var containsbadword = false;
  133. foreach (IMessage message in items)
  134. {
  135. foreach (string bannedWord in Program.bannedWords)
  136. {
  137. var bypass2 = message.Content.ToLower().Replace(" ", "");
  138. 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");
  139. var bypass4 = bypass.Replace("'s", " is");
  140. var bypass3 = bypass.Replace(" ", "");
  141. 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");
  142. var bypass6 = bypass.Replace("*", "");
  143.  
  144. if (!message.Content.ToLower().Contains(bannedWord) && !bypass.Contains(bannedWord))
  145. {
  146. containsbadword = false;
  147. }
  148. else
  149. {
  150. containsbadword = true;
  151. break;
  152. }
  153. }
  154. if (containsbadword)
  155. {
  156. i++;
  157. Console.WriteLine(message.Content);
  158. } else
  159. {
  160. a.Remove(message);
  161. }
  162. }
  163. await Context.Channel.DeleteMessagesAsync(a);
  164. var msg = await ReplyAsync("Removed **" + i + "** inappropriate messages :white_check_mark:");
  165. await Task.Delay(3000);
  166. await msg.DeleteAsync();
  167. }
  168.  
  169. [Command("check")]
  170. [RequireUserPermission(GuildPermission.BanMembers)]
  171. public async Task CheckAsync(int delnum, ulong id)
  172. {
  173. Console.WriteLine("Beginning check...");
  174. var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
  175. await Task.Delay(1000);
  176. var message = await ReplyAsync($"Checking messages...");
  177. float number = 0;
  178. List<string> messages = new List<string>();
  179. foreach (IMessage item in items)
  180. {
  181. if (item.Author.Id == id)
  182. {
  183. number++;
  184. float x = number / (delnum + 1) * 100.0f;
  185. var percentage = (int)(number / (delnum + 1) * 100.0f);
  186.  
  187. foreach (string bannedWord in Program.bannedWords)
  188. {
  189. var a = $"{item.Author} Link: https://discordapp.com/channels/513087151563341825/{item.Channel.Id}/{item.Id}";
  190. if (item.Content.ToLower().Contains(bannedWord))
  191. {
  192. if (!messages.Contains(a))
  193. {
  194. Console.WriteLine($"{a} ({bannedWord})");
  195. messages.Add(a);
  196. }
  197. }
  198. }
  199. }
  200. }
  201. await message.ModifyAsync(msg => msg.Content = $"Checked all messages! (result in console)");
  202. Console.WriteLine("Completed!");
  203. }
  204.  
  205. [Command("getmessages")]
  206. [RequireUserPermission(GuildPermission.ManageNicknames)]
  207. public async Task GetMessagesAsync(int delnum, ulong id)
  208. {
  209. Console.WriteLine("Beginning check...");
  210. var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
  211. await Task.Delay(1000);
  212. var message = await ReplyAsync($"Checking messages...");
  213. float number = 0;
  214. List<string> messages = new List<string>();
  215. foreach (IMessage item in items)
  216. {
  217. if (item.Author.Id == id)
  218. {
  219. number++;
  220. float x = number / (delnum + 1) * 100.0f;
  221. var percentage = (int)(number / (delnum + 1) * 100.0f);
  222. var a = $@"ID: {item.Id} Link: https://discordapp.com/channels/513087151563341825/{item.Channel.Id}/{item.Id}";
  223. if (!messages.Contains(a))
  224. {
  225. Console.WriteLine(a);
  226. messages.Add(a);
  227. }
  228. }
  229. }
  230. await message.ModifyAsync(msg => msg.Content = $"Checked all messages! (result in console)");
  231. Console.WriteLine("Completed!");
  232. }
  233.  
  234. [Command("discorduser")]
  235. [RequireUserPermission(GuildPermission.ManageNicknames)]
  236. public async Task GetDiscordUser(ulong id)
  237. {
  238. var user = Program.client.GetUser(id);
  239. var builder = new EmbedBuilder();
  240. builder.WithTitle(user.Username);
  241. builder.WithAuthor(user);
  242. var date = user.CreatedAt.ToString().Split(' ');
  243. builder.WithDescription($"**Account created:** {date[0]} ({(DateTime.Now - user.CreatedAt).Days} days ago))");
  244. builder.WithFooter($"ID: {user.Id}");
  245. await ReplyAsync("", false, builder);
  246. }
  247.  
  248. [Command("check")]
  249. [RequireUserPermission(GuildPermission.ManageNicknames)]
  250. public async Task CheckAsync(int delnum)
  251. {
  252. Console.WriteLine("Beginning check...");
  253. var items = await Context.Channel.GetMessagesAsync(delnum + 1).Flatten();
  254. await Task.Delay(1000);
  255. var message = await ReplyAsync($"Checking messages...");
  256. float number = 0;
  257. List<string> messages = new List<string>();
  258. foreach (IMessage item in items)
  259. {
  260. number++;
  261. float x = number / (delnum + 1) * 100.0f;
  262. var percentage = (int)(number / (delnum + 1) * 100.0f);
  263. foreach (string bannedWord in Program.bannedWords)
  264. {
  265. var a = $"{item.Author} Link: https://discordapp.com/channels/513087151563341825/{item.Channel.Id}/{item.Id}";
  266. if (item.Content.ToLower().Contains(bannedWord))
  267. {
  268. if (!messages.Contains(a))
  269. {
  270. Console.WriteLine($"{a} ({bannedWord})");
  271. messages.Add(a);
  272. }
  273. }
  274. }
  275. }
  276. await message.ModifyAsync(msg => msg.Content = $"Checked all messages! (result in console)");
  277. Console.WriteLine("Completed!");
  278. }
  279.  
  280. [Command("watchlist"), Alias("wl")]
  281. [RequireUserPermission(GuildPermission.ManageNicknames)]
  282. public async Task WatchAsync(string parameter, IGuildUser user, [Remainder]string description = "")
  283. {
  284. var id = user.Id.ToString();
  285. var watchlist = Program.watchlistUsers;
  286. if (parameter == "add")
  287. {
  288. if (!watchlist.Contains(id))
  289. {
  290. watchlist.Add(id);
  291. Program.watchlistTimes.Add(DateTime.Now);
  292. int index = Array.IndexOf(watchlist.ToArray(), id);
  293.  
  294.  
  295. if (description != "")
  296. {
  297. Program.descriptions.Add(description);
  298. }
  299. else
  300. {
  301. Program.descriptions.Add("none");
  302. }
  303.  
  304. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\users.txt", watchlist);
  305. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\descriptions.txt", Program.descriptions);
  306. List<string> watchTimes = new List<string>();
  307. foreach (DateTime time in Program.watchlistTimes)
  308. {
  309. watchTimes.Add(time.ToString());
  310. }
  311. File.WriteAllLines($@"C:\Users\{Program.user}\times.txt", watchTimes);
  312. await ReplyAsync($"Added user **{user}** to the watchlist :eyes:");
  313. }
  314. else
  315. {
  316. await ReplyAsync($"User **{user}** is already on the watchlist :x:");
  317. }
  318. }
  319. else if (parameter == "remove" || parameter == "delete" || parameter == "del")
  320. {
  321. int index = Array.IndexOf(Program.watchlistUsers.ToArray(), id);
  322. Program.watchlistTimes.Remove(Program.watchlistTimes[index]);
  323. watchlist.Remove(id);
  324. Program.descriptions.Remove(Program.descriptions[index]);
  325. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\users.txt", watchlist);
  326. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\descriptions.txt", Program.descriptions);
  327. await ReplyAsync($"Removed **{user}** from the watchlist :white_check_mark:");
  328. }
  329. else
  330. {
  331. await Context.Channel.SendMessageAsync($"Too few parameters, the correct usage is **{Program.prefix}wl add <user> <description>** or **{Program.prefix}wl remove <user>**");
  332. }
  333. }
  334.  
  335. [Command("user"), Alias("wl")]
  336. [RequireUserPermission(GuildPermission.ManageNicknames)]
  337. public async Task WatchListUserAsync(IGuildUser user)
  338. {
  339. var id = user.Id.ToString();
  340. var watchlist = Program.watchlistUsers;
  341. var builder = new EmbedBuilder();
  342. builder.WithTitle(user.Username);
  343. builder.WithAuthor(user);
  344. var date = user.CreatedAt.ToString().Split(' ');
  345. var joindate = user.JoinedAt.ToString().Split(' ');
  346. 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)");
  347. builder.WithFooter($"ID: {user.Id}");
  348. if (Program.watchlistUsers.Contains(id.ToString()))
  349. {
  350. int index = Array.IndexOf(Program.watchlistUsers.ToArray(), id);
  351. var timeNow = Program.watchlistTimes.ToArray()[index];
  352. var time = (DateTime.Now - timeNow);
  353. var days = time.Days;
  354. var hours = time.Hours;
  355. var minutes = time.Minutes;
  356. var seconds = time.Seconds;
  357. var description = Program.descriptions[index];
  358. if (days > 0)
  359. {
  360. 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)");
  361. }
  362. else if (hours > 0)
  363. {
  364. 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)");
  365. }
  366. else if (minutes > 0)
  367. {
  368. 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)");
  369. } else
  370. {
  371. 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)");
  372. }
  373. }
  374. await ReplyAsync("", false, builder);
  375. }
  376.  
  377. /* [Command("lockdown")]
  378. [RequireUserPermission(GuildPermission.BanMembers)]
  379. public async Task LockdownAsync(string parameter)
  380. {
  381. var channels = Context.Guild.TextChannels;
  382. var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "@everyone");
  383. var muterole = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
  384. var muted = muterole.Permissions;
  385. IUserMessage message = null;
  386.  
  387.  
  388. if (parameter == "remove" || parameter == "cancel" || parameter == "open" || parameter == "undo")
  389. {
  390. message = await ReplyAsync($"Unlocking all channels...🔒");
  391. foreach (IGuildChannel txt in channels)
  392. {
  393. var none = OverwritePermissions.InheritAll;
  394. await txt.AddPermissionOverwriteAsync(role, none, null);
  395. }
  396. await role.ModifyAsync(x =>
  397. {
  398. x.Permissions = muted;
  399. });
  400. await message.ModifyAsync(msg => msg.Content = $"All channels are now unlocked and everyone is able to send messages again 🔓 ");
  401. }
  402. else
  403. {
  404. message = await ReplyAsync($"Locking all channels... 🔓 ");
  405. foreach (IGuildChannel txt in channels)
  406. {
  407. var none = OverwritePermissions.DenyAll(txt);
  408. await txt.AddPermissionOverwriteAsync(role, none, null);
  409. }
  410. await role.ModifyAsync(x =>
  411. {
  412. x.Permissions = muted;
  413. });
  414. await message.ModifyAsync(msg => msg.Content = $"Members without role are now unable to see and send messages in any channel. 🔒");
  415. }
  416. } */
  417.  
  418. [Command("watchlist"), Alias("wl")]
  419. [RequireUserPermission(GuildPermission.ManageNicknames)]
  420. public async Task WatchListAsync()
  421. {
  422. var watchlist = Program.watchlistUsers;
  423. var builder = new EmbedBuilder();
  424. builder.WithTitle("Users on watch list");
  425. builder.WithAuthor(Program.client.CurrentUser);
  426. builder.WithThumbnailUrl(@"http://rxview.adverahealth.com/hubfs/FDA%20Releases%20Q1%202017%20Drug%20Safety%20Watchlist.png");
  427. foreach (string user in watchlist)
  428. {
  429. int index = Array.IndexOf(Program.watchlistUsers.ToArray(), user);
  430. var timeNow = Program.watchlistTimes.ToArray()[index];
  431. var description = Program.descriptions.ToArray()[index];
  432. var time = (DateTime.Now - timeNow);
  433. var days = time.Days;
  434. var hours = time.Hours;
  435. var minutes = time.Minutes;
  436. var seconds = time.Seconds;
  437. if (days > 0)
  438. {
  439. 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");
  440. }
  441. else if (hours > 0)
  442. {
  443. builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {hours} hours and {minutes} minutes ago");
  444. }
  445. else if (minutes > 0)
  446. {
  447. builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {minutes} minutes ago");
  448. }
  449. else
  450. {
  451. builder.AddField(Program.client.GetUser(Convert.ToUInt64(user)).ToString(), "**ID: **" + user + $"\n **Description:** {description} \n Last seen {seconds} seconds ago");
  452. }
  453. }
  454. await ReplyAsync("", false, builder);
  455. }
  456.  
  457. [Command("mute")]
  458. [RequireUserPermission(GuildPermission.BanMembers)]
  459. public async Task MuteAsync(IGuildUser user)
  460. {
  461. var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
  462. await (user as IGuildUser).AddRoleAsync(role);
  463. await ReplyAsync("*Muted** " + user + "** indefinitely* ✅");
  464. }
  465.  
  466. [Command("unmute")]
  467. [RequireUserPermission(GuildPermission.BanMembers)]
  468. public async Task UnmuteAsync(IGuildUser user)
  469. {
  470. var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Muted");
  471. await (user as IGuildUser).RemoveRoleAsync(role);
  472. await ReplyAsync("*Unmuted **" + user + "*** ✅");
  473. }
  474.  
  475.  
  476. [Command("removepings")]
  477. [RequireUserPermission(GuildPermission.BanMembers)]
  478. public async Task PingAsync(bool remove)
  479. {
  480. await ReplyAsync("Remove pings is now set to ``" + remove + "``");
  481. Program.allowPings = !remove;
  482. }
  483.  
  484. [Command("tiktok")]
  485. public async Task TikTok(string video)
  486. {
  487. await Context.Message.DeleteAsync();
  488. await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\NyanBot\{video}.mp4");
  489. }
  490.  
  491. [Command("tiktoklist"), Alias("tiktoks")]
  492. public async Task TikTokList()
  493. {
  494. var builder = new EmbedBuilder();
  495. builder.WithTitle("All TikToks");
  496. builder.WithAuthor(Program.client.CurrentUser);
  497. builder.AddInlineField("__**Nico Yazawa**__", "hitormiss \n soda \n dame");
  498. builder.AddInlineField("__**Katia (OC)**__", "hitormiss2 \n startafight \n sandman \n vexing \n smileteeth");
  499. builder.AddInlineField("__**Momo (OC)**__", "hitormiss \n soda \n dame");
  500. builder.AddInlineField("__**Yuno Gasai**__", "yunodraft \n sociopath \n dontkillme \n friends \n vanilla");
  501. builder.AddInlineField("__**Toga**__", "senpai \n neck \n oneyoulove \n whatsthatspell \n");
  502. builder.AddInlineField("__**Rin Kagamine**__", "imsorry \n \n");
  503. builder.AddInlineField("__**Zero Two**__", "bullseye \n unconditionally \n mamatoldme \n nobodylikesme");
  504. builder.AddInlineField("__**Monika**__", "hitormiss3 \n monika \n");
  505. builder.AddInlineField("__**No Cosplay**__", "million");
  506. await ReplyAsync("", false, builder);
  507. }
  508.  
  509. [Command("antiswear")]
  510. [RequireUserPermission(GuildPermission.BanMembers)]
  511. public async Task BadWord(int level)
  512. {
  513. await Context.Message.DeleteAsync();
  514. Program.swearLevel = level;
  515. await ReplyAsync($"Anti-swear level set to **{level}: {Program.swearLevels[level - 1]}**");
  516. }
  517.  
  518. [Command("addbadword")]
  519. [RequireUserPermission(GuildPermission.BanMembers)]
  520. public async Task BadWord(string word)
  521. {
  522. await Context.Message.DeleteAsync();
  523. await ReplyAsync($"Added `{word}` to banned words");
  524. Program.bannedWords.Add(word);
  525. }
  526.  
  527. [Command("removebadword")]
  528. [RequireUserPermission(GuildPermission.BanMembers)]
  529. public async Task RemoveBadWord(string word)
  530. {
  531. await Context.Message.DeleteAsync();
  532. await ReplyAsync($"Removed `{word}` from banned words");
  533. Program.bannedWords.Remove(word);
  534. }
  535.  
  536. [Command("avatar"), Alias("av")]
  537. public async Task PingAsync(SocketGuildUser user)
  538. {
  539.  
  540. var embed = new EmbedBuilder();
  541. embed.WithAuthor(user);
  542. embed.WithDescription("**Avatar**");
  543. embed.WithImageUrl(user.GetAvatarUrl());
  544. embed.WithColor(Discord.Color.DarkGrey);
  545. await ReplyAsync("", false, embed);
  546. }
  547.  
  548. [Command("testnewtiktok")]
  549. [RequireUserPermission(GuildPermission.BanMembers)]
  550. public async Task TFNgAsync(SocketGuildUser user)
  551. {
  552. var embed = new EmbedBuilder();
  553. embed.WithTitle("**Nyannyancosplay TikTok**");
  554. embed.WithColor(Discord.Color.DarkerGrey);
  555. embed.WithDescription("*20 year old cosplayer Tag: #nyarmy💛 ♑️ | Hufflepuff | GIRL Spread Love* \n \n" + $"**Nyannyancosplay just uploaded a new TikTok!💛**");
  556.  
  557. await Program.client.GetGuild(513087151563341825).GetTextChannel(578328255661342745).SendMessageAsync("@everyone", false, embed);
  558. }
  559.  
  560. [Command("speak")]
  561. [RequireUserPermission(GuildPermission.BanMembers)]
  562. public async Task bAsync(string a)
  563. {
  564. await Program.client.GetGuild(513087151563341825).GetTextChannel(513087151563341827).SendMessageAsync(a);
  565. }
  566.  
  567. [Command("tiktok"), Alias("kat")]
  568. public async Task Refresh()
  569. {
  570. using (WebClient client = new WebClient())
  571. {
  572. client.Headers["User-Agent"] = "C# TikTok";
  573. string followers = "";
  574. string following = "";
  575. string avatarUrl = "";
  576. string hearts = "";
  577. string videos = "";
  578. var htmlCode = Program.htmlCode;
  579. int Start, End;
  580. int Start2, End2;
  581. int Start3, End3;
  582. int Start4, End4;
  583. int Start5, End5;
  584.  
  585. string strStart = "wing</span></p>";
  586. string strEnd = "k";
  587.  
  588. string strStart2 = "<strong class=";
  589. string strEnd2 = "<";
  590.  
  591. string strStart3 = "avatar_larger";
  592. string strEnd3 = ",";
  593.  
  594. string strStart4 = "Followers</span>";
  595. string strEnd4 = "m<";
  596.  
  597. string strStart5 = "heart";
  598. string strEnd5 = @",""verified""";
  599.  
  600. if (htmlCode.Contains(strStart) && htmlCode.Contains(strEnd))
  601. {
  602. Start = htmlCode.IndexOf(strStart, 0) + strStart.Length;
  603. End = htmlCode.IndexOf(strEnd, Start);
  604. followers = htmlCode.Substring(Start, End - Start).Substring(42);
  605.  
  606. }
  607. if (htmlCode.Contains(strStart2) && htmlCode.Contains(strEnd2))
  608. {
  609. Start2 = htmlCode.IndexOf(strStart2, 0) + strStart2.Length;
  610. End2 = htmlCode.IndexOf(strEnd2, Start2);
  611. following = htmlCode.Substring(Start2, End2 - Start2).Substring(9);
  612. following = following.Substring(0, following.Length);
  613. }
  614.  
  615. if (htmlCode.Contains(strStart3) && htmlCode.Contains(strEnd3))
  616. {
  617. Start3 = htmlCode.IndexOf(strStart3, 0) + strStart3.Length;
  618. End3 = htmlCode.IndexOf(strEnd3, Start3);
  619. avatarUrl = htmlCode.Substring(Start3, End3 - Start3).Substring(20);
  620. avatarUrl = avatarUrl.Substring(0, avatarUrl.Length - 1);
  621. avatarUrl = "http://" + avatarUrl;
  622. }
  623.  
  624. if (htmlCode.Contains(strStart4) && htmlCode.Contains(strEnd4))
  625. {
  626. Start4 = htmlCode.IndexOf(strStart4, 0) + strStart4.Length;
  627. End4 = htmlCode.IndexOf(strEnd4, Start4);
  628. hearts = htmlCode.Substring(Start4, End4 - Start4).Substring(72);
  629. }
  630.  
  631. if (htmlCode.Contains(strStart5) && htmlCode.Contains(strEnd5))
  632. {
  633. Start5 = htmlCode.IndexOf(strStart5, 0) + strStart5.Length;
  634. End5 = htmlCode.IndexOf(strEnd5, Start5);
  635. videos = htmlCode.Substring(Start5, End5 - Start5).Substring(18);
  636. }
  637.  
  638. var embed = new EmbedBuilder();
  639. embed.WithTitle("**Nyannyancosplay TikTok**");
  640. embed.WithColor(Discord.Color.DarkerGrey);
  641. 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**");
  642. embed.WithThumbnailUrl("https://m-p16.akamaized.net/img/musically-maliva-obj/1619974882678790~c5_720x720.jpeg");
  643. await ReplyAsync("", false, embed);
  644. }
  645.  
  646. }
  647.  
  648. [Command("rule")]
  649. public async Task Rule(int rule)
  650. {
  651. await Context.Channel.SendMessageAsync($"```{Program.rules[rule - 1]}```");
  652. }
  653.  
  654. [Command("tiktokrandom"), Alias("randomtiktok")]
  655. public async Task TikTokRandom()
  656. {
  657. var user = Context.User.Id.ToString();
  658. if (!Program.cooldownUsers.Contains(user))
  659. {
  660. Program.cooldownUsers.Add(user);
  661. Program.cooldowns.Add(DateTime.Now.AddMinutes(-1));
  662. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
  663. List<string> cooldowns = new List<string>();
  664. foreach (DateTime time in Program.cooldowns)
  665. {
  666. cooldowns.Add(time.ToString());
  667. }
  668. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
  669. }
  670.  
  671. var index = Program.cooldownUsers.FindIndex(x => x.Equals(Context.User.Id.ToString()));
  672. var OG = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "OG");
  673. var Trusted = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Trusted");
  674. var Active = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Active");
  675.  
  676. if (Context.Channel == Context.Channel)
  677. {
  678.  
  679. await Context.Channel.TriggerTypingAsync();
  680. Random rnd = new Random();
  681. int number = rnd.Next(1, Program.tiktoks);
  682. if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 5 && File.Exists($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4"))
  683. {
  684. if (number == 126)
  685. {
  686. await Context.Channel.SendFileAsync($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4", "You rolled **Hit or miss** <:Huh_2: 514118688086032414>");
  687. }
  688. else
  689. {
  690. await Context.Channel.SendFileAsync($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4");
  691. }
  692. Program.cooldowns[index] = DateTime.Now;
  693. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
  694. List<string> cooldowns = new List<string>();
  695. foreach (DateTime time in Program.cooldowns)
  696. {
  697. cooldowns.Add(time.ToString());
  698. }
  699. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
  700. }
  701. else if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 5 && !File.Exists($@"C:\Users\Administrator\Desktop\tiktoks\tiktok_{number}.mp4"))
  702. {
  703. await ReplyAsync($"{Context.User.Mention} Failed to send file. Please try again.");
  704. }
  705. else
  706. {
  707. await ReplyAsync($"{Context.User.Mention} Please wait another {(int)(5 - (DateTime.Now - Program.cooldowns[index]).TotalSeconds)} seconds.");
  708. }
  709. }
  710. }
  711.  
  712. [Command("tiktokboom"), Alias("tiktikboom")]
  713. public async Task TikTokBoom()
  714. {
  715. if (!Program.isSending)
  716. {
  717. List<int> prevTikToks = new List<int>();
  718. var ModJr = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Mod Jr");
  719. var Mod = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Moderator");
  720. if ((Context.User as SocketGuildUser).Roles.Contains(ModJr) || (Context.User as SocketGuildUser).Roles.Contains(Mod))
  721. {
  722. for (int i = 0; i < 5; ++i)
  723. {
  724. Random rnd = new Random();
  725. int number = rnd.Next(1, 201);
  726. if (File.Exists($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4") && !prevTikToks.Contains(number))
  727. {
  728. await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4");
  729. prevTikToks.Add(number);
  730. }
  731. else
  732. {
  733. Random rnd1 = new Random();
  734. int number1 = rnd.Next(1, 201);
  735. await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number1}.mp4");
  736. }
  737.  
  738. if (i >= 4)
  739. {
  740. prevTikToks.Clear();
  741. }
  742. }
  743. }
  744. Program.isSending = true;
  745. }
  746. }
  747.  
  748. [Command("tiktokbet"), Alias("tiktikbet")]
  749. [RequireBotPermission(GuildPermission.BanMembers)]
  750. [RequireUserPermission(GuildPermission.BanMembers)]
  751. public async Task TikTokBet([Remainder]string cosp)
  752. {
  753. var user = Context.User.Id.ToString();
  754. if (!Program.cooldownUsers.Contains(user))
  755. {
  756. Program.cooldownUsers.Add(user);
  757. Program.cooldowns.Add(DateTime.Now.AddMinutes(-1));
  758. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
  759. List<string> cooldowns = new List<string>();
  760. foreach (DateTime time in Program.cooldowns)
  761. {
  762. cooldowns.Add(time.ToString());
  763. }
  764. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
  765. }
  766.  
  767. var index = Program.cooldownUsers.FindIndex(x => x.Equals(Context.User.Id.ToString()));
  768. var OG = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "OG");
  769. var Trusted = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Trusted");
  770. var Active = (Context.User as IGuildUser).Guild.Roles.FirstOrDefault(x => x.Name == "Active");
  771.  
  772. if (Context.Channel == Context.Channel)
  773. {
  774.  
  775. if ((Context.User as SocketGuildUser).Roles.Contains(OG) || (Context.User as SocketGuildUser).Roles.Contains(Trusted) || (Context.User as SocketGuildUser).Roles.Contains(Active))
  776. {
  777. await Context.Channel.TriggerTypingAsync();
  778. Random rnd = new Random();
  779. int number = rnd.Next(1, 201);
  780. if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 0 && File.Exists($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4"))
  781. {
  782. 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))
  783. {
  784. await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4", $"{Context.User.Mention} You guessed it correctly **+5 credits**");
  785. }
  786. else
  787. {
  788. await Context.Channel.SendFileAsync($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4", "Wrong **-5 credits**");
  789. }
  790. Program.cooldowns[index] = DateTime.Now;
  791. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldownusers.txt", Program.cooldownUsers);
  792. List<string> cooldowns = new List<string>();
  793. foreach (DateTime time in Program.cooldowns)
  794. {
  795. cooldowns.Add(time.ToString());
  796. }
  797. File.WriteAllLines($@"C:\Users\{Program.user}\Desktop\cooldowntimes.txt", cooldowns);
  798. }
  799. else if ((DateTime.Now - Program.cooldowns[index]).TotalSeconds > 0 && !File.Exists($@"C:\Users\{Program.user}\Desktop\tiktoks\tiktok_{number}.mp4"))
  800. {
  801. await ReplyAsync($"{Context.User.Mention} Failed to send file. Please try again.");
  802. }
  803. else
  804. {
  805. await ReplyAsync($"{Context.User.Mention} Please wait another {(int)(15 - (DateTime.Now - Program.cooldowns[index]).TotalSeconds)} seconds.");
  806. }
  807. }
  808. }
  809. }
  810.  
  811. [Command("chances")]
  812. [RequireBotPermission(GuildPermission.BanMembers)]
  813. [RequireUserPermission(GuildPermission.BanMembers)]
  814. public async Task ChancesAsync()
  815. {
  816. int totalLength = Program.OOC.ToArray().Length + Program.Rin.ToArray().Length + Program.Nico.ToArray().Length + Program.O2.ToArray().Length;
  817. double chanceRin = ((double)Program.Rin.ToArray().Length) / totalLength;
  818. double chanceOOC = ((double)Program.OOC.ToArray().Length) / totalLength;
  819. double chanceNico = ((double)Program.Nico.ToArray().Length) / totalLength;
  820. double chance02 = ((double)Program.O2.ToArray().Length) / totalLength;
  821. double chanceYuno = ((double)Program.OOC.ToArray().Length) / totalLength;
  822. double chanceKeiko = ((double)Program.OOC.ToArray().Length) / totalLength;
  823. var builder = new EmbedBuilder();
  824. builder.WithTitle("Roll chances");
  825. builder.WithAuthor(Program.client.CurrentUser);
  826. builder.AddField($"**OOC:**", $"{(int)(chanceOOC * 100)}%");
  827. builder.AddField($"**Rin Kagamine:**", $"{(int)(chanceRin * 100)}%");
  828. builder.AddField($"**Nico Yazawa:**", $"{(int)(chanceNico * 100)}%");
  829. builder.AddField($"**Zero Two:**", $"{(int)(chance02 * 100)}%");
  830. await ReplyAsync("", false, builder);
  831. }
  832.  
  833. [Command("ban")]
  834. [RequireBotPermission(GuildPermission.BanMembers)]
  835. [RequireUserPermission(GuildPermission.BanMembers)]
  836. public async Task BanAsync(IGuildUser user)
  837. {
  838. await ReplyAsync("Banned **" + user + "** from the server ✅");
  839. await Context.Guild.AddBanAsync(user);
  840. }
  841.  
  842. [Command("kick")]
  843. [RequireBotPermission(GuildPermission.KickMembers)]
  844. [RequireUserPermission(GuildPermission.BanMembers)]
  845. public async Task KickAsync(IGuildUser user)
  846. {
  847. await ReplyAsync("*Kicked **" + user + "** from the server* ✅");
  848. await user.KickAsync();
  849. }
  850.  
  851. [Command("prefix")]
  852. [RequireUserPermission(GuildPermission.BanMembers)]
  853. public async Task StinkAsync(string prefix)
  854. {
  855. await ReplyAsync($"Prefix changed to `{prefix}`");
  856. Program.prefix = prefix;
  857. File.WriteAllText($@"C:\Users\{Program.user}\Desktop\prefix.txt", prefix);
  858. }
  859. }
  860. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement