Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Discord;
  5. using Discord.Commands;
  6. using Discord.WebSocket;
  7. using System.Threading.Tasks;
  8.  
  9. namespace DiscordSelfBot {
  10.     public class RequireOwnerAttribute : PreconditionAttribute {
  11.         // Override the CheckPermissions method
  12.         public async override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IDependencyMap map) {
  13.             // Get the ID of the bot's owner
  14.             //var ownerId = (await map.Get<DiscordSocketClient>().GetApplicationInfoAsync()).Owner.Id;
  15.             var ownerId = context.Client.CurrentUser.Id;
  16.             // If this command was executed by that user, return a success
  17.             if (context.User.Id == ownerId)
  18.                 return PreconditionResult.FromSuccess();
  19.             // Since it wasn't, fail
  20.             else
  21.                 return PreconditionResult.FromError("");
  22.         }
  23.     }
  24.  
  25.     [RequireOwner]
  26.     public class BotModules : ModuleBase<SocketCommandContext> {
  27.  
  28.         [Command("say"), Summary("Echos a message.")]
  29.         public async Task Say([Remainder, Summary("The text to echo")] string echo) {
  30.             // ReplyAsync is a method on ModuleBase
  31.             await ReplyAsync(echo);
  32.         }
  33.         [Command("daddy"), Summary("Gives you a neat copypasta")]
  34.         public async Task Daddy() {
  35.             var message = Context.Message;
  36.             await message.ModifyAsync(x => x.Content = System.IO.File.ReadAllText(@"C:\Users\Kupo\Documents\KupoBot\copypaste\daddy.txt"));
  37.         }
  38.         [Command("goodshit"), Summary("Gives you a neat copypasta")]
  39.         public async Task GoodShit() {
  40.             var message = Context.Message;
  41.             await message.ModifyAsync(x => x.Content = System.IO.File.ReadAllText(@"C:\Users\Kupo\Documents\KupoBot\copypaste\goodshit.txt"));
  42.         }
  43.         [Command("navyseal"), Summary("Gives you a neat copypasta")]
  44.         public async Task NavySeal() {
  45.             var message = Context.Message;
  46.             await message.ModifyAsync(x => x.Content = System.IO.File.ReadAllText(@"C:\Users\Kupo\Documents\KupoBot\copypaste\navyseals.txt"));
  47.         }
  48.         [Command("bedroom"), Summary("Gives you a neat copypasta")]
  49.         public async Task Bedroom() {
  50.             var message = Context.Message;
  51.             await message.ModifyAsync(x => x.Content = System.IO.File.ReadAllText(@"C:\Users\Kupo\Documents\KupoBot\copypaste\bedroom.txt"));
  52.         }
  53.         [Command("bm"), Summary("Gives you a neat copypasta")]
  54.         public async Task BrunoMars() {
  55.             var message = Context.Message;
  56.             await message.ModifyAsync(x => x.Content = System.IO.File.ReadAllText(@"C:\Users\Kupo\Documents\KupoBot\copypaste\bruno.txt"));
  57.         }
  58.         [Command("nintendo"), Summary("Gives you a neat copypasta")]
  59.         public async Task Nintendo() {
  60.             var message = Context.Message;
  61.             await message.ModifyAsync(x => x.Content = System.IO.File.ReadAllText(@"C:\Users\Kupo\Documents\KupoBot\copypaste\nintendo.txt"));
  62.         }
  63.         [Command("confused"), Summary("Gives you a neat copypasta")]
  64.         public async Task Confused() {
  65.             var message = Context.Message;
  66.             await message.ModifyAsync(x => x.Content = "​\n" + "<:c1:317924541500227587><:c2:317924541915594752><:c3:317924541957537792><:c4:317924541592633346><:c5:317924541886103553>" + "\n"
  67.                             + "<:c6:317924541974446080><:c7:317924541760536588><:c8:317924541987028992><:c9:317924541735370755><:c10:317924542012063744>" + "\n"
  68.                             + "<:c11:317929336873287681><:c12:317929336915361793><:c13:317929337162694656><:c14:317929336873287691><:c15:317929337183666186>" + "\n"
  69.                             + "<:c16:317929337175146496><:c17:317929336810373132><:c18:317929337225478144><:c19:317929337192185856><:c20:317929337233997824>" + "\n"
  70.                             + "<:c21:317929337208963072><:c22:317929337275940864><:c23:317929337124945922><:c24:317929337208963073><:c25:317929336948916226>");
  71.         }
  72.         [Command("setgame")]
  73.         public async Task SetGame(string game) {
  74.             var message = Context.Message;
  75.             await Context.Client.SetGameAsync(game);
  76.             await message.ModifyAsync(x => x.Content = "set game to " + "\"" + game + "\"");
  77.         }
  78.         /*[Command("purge"), Summary("Prunes a specified number of messages.")]
  79.         public async Task purgeMessages(uint amount) {
  80.             var messages = await this.Context.Channel.GetMessagesAsync((int)amount + 1).Flatten();
  81.  
  82.             await this.Context.Channel.DeleteMessagesAsync(messages);
  83.             const int delay = 5000;
  84.             var m = await this.ReplyAsync("purge complete.");
  85.             await Task.Delay(delay);
  86.             await m.DeleteAsync();
  87.         }*/
  88.     }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement