Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //My Bot Class File
- using Discord;
- using Discord.Commands;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication6
- {
- class MyBot
- {
- DiscordClient bot;
- public MyBot()
- {
- bot = new DiscordClient(x =>
- {
- x.LogLevel = LogSeverity.Info;
- x.LogHandler = Log;
- });
- bot.UsingCommands(x =>
- {
- x.PrefixChar = '!';
- x.AllowMentionPrefix = true;
- });
- var commands = bot.GetService<CommandService>();
- commands.CreateCommand("hello")
- .Do(async (e) =>
- {
- await e.Channel.SendMessage("Sup");
- });
- bot.ExecuteAndWait(async () =>
- {
- await bot.Connect("MyTokenXD", TokenType.Bot);
- });
- }
- // Log servers in console.
- private void Log(object sender, LogMessageEventArgs e)
- {
- Console.WriteLine(e.Message);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement