Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Discord;
- using Discord.Commands;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FoxBot
- {
- class MyBot
- {
- DiscordClient discord;
- CommandService commands;
- Random rand;
- string[] RFoxes;
- string[] R8ball;
- public MyBot()
- {
- rand = new Random();
- RFoxes = new string[]
- {
- "Foxes/Fox1.jpg",
- "Foxes/Fox2.jpg",
- "Foxes/Fox3.jpg",
- "Foxes/Fox4.jpg",
- "Foxes/Fox5.jpg",
- "Foxes/Fox6.jpg",
- "Foxes/Fox7.jpg",
- "Foxes/Fox8.jpg",
- "Foxes/Fox9.jpg",
- "Foxes/Fox10.jpg"
- };
- R8ball = new string[]
- {
- "It is certain",
- "It is decidedly so",
- "Without a doubt",
- "Yes, definitely",
- "You may rely on it",
- "As I see it, yes",
- "Most likely",
- "Outlook good",
- "Yes",
- "Signs point to yes",
- "Reply hazy try again",
- "Ask again later",
- "Better not tell you now",
- "Cannot predict now",
- "Concentrate and ask again",
- "Don't count on it",
- "My reply is no",
- "My sources say no",
- "Outlook not so good",
- "Very doubtful"
- };
- discord = new DiscordClient(x =>
- {
- x.LogLevel = LogSeverity.Info;
- x.LogHandler = Log;
- });
- discord.UsingCommands(x =>
- {
- x.PrefixChar = '~';
- x.AllowMentionPrefix = true;
- });
- commands = discord.GetService<CommandService>();
- RegisterFoxCommand();
- commands.CreateCommand("test")
- .Do(async (e) =>
- {
- await e.Channel.SendMessage("Hi!");
- });
- commands.CreateCommand("help")
- .Do(async (e) =>
- {
- await e.User.SendMessage("Nothing to see here (test)");
- await e.Channel.SendMessage("```I have sent you my commands!```");
- });
- discord.ExecuteAndWait(async () =>
- {
- await discord.Connect("MjgyODkzODcwMjA5OTU3ODg5.C4wf0Q.RxXLwEgdr1TWjn-nS5RCbd4qAFg", TokenType.Bot);
- discord.SetGame("use ~help for help");
- });
- }
- private void RegisterFoxCommand()
- {
- commands.CreateCommand("Fox")
- .Do(async (e) =>
- {
- int RandomFoxIndex = rand.Next(RFoxes.Length);
- string FoxToPost = RFoxes[RandomFoxIndex];
- await e.Channel.SendFile(FoxToPost);
- });
- }
- private void Register8ballCommand()
- {
- commands.CreateCommand("8ball")
- .Do(async (e) =>
- {
- int Random8ball = rand.Next(R8ball.Length);
- string Answer = R8ball[Random8ball];
- await e.Channel.SendMessage(Answer);
- });
- }
- private void Log(object sender, LogMessageEventArgs e)
- {
- Console.WriteLine(e.Message);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement