bot not working
unknown
csharp
4 years ago
1.6 kB
9
Indexable
using System; using System.Threading.Tasks; using System.IO; using System.Linq; using System.Collections.Generic; using Discord; using Discord.WebSocket; namespace CSharp_Shell { public class Program { static DiscordSocketClient client = new DiscordSocketClient(); static async Task Main() { client.Log += async (a) => await Log(a); client.MessageReceived += async (a) => await MessageRecieved(a); await client.LoginAsync(TokenType.Bot, "..-g"); //the bot crashes even when the api token is correct await client.StartAsync(); await Task.Delay(-1); await client.StopAsync(); } public static async Task Log(LogMessage lm) { Console.WriteLine(lm.Message); } public static string[] commands = new string[] { "%hug", "%kiss", "%pat", "%help", "%fc", "%cry", "%gel", "%fuck", "%lewd" }; public static async Task MessageRecieved(SocketMessage sm) { Console.WriteLine(sm.Content); var me = client.CurrentUser.Id; if (sm.Author.Id == me) return; foreach(var com in commands) { if (sm.Content.Contains(com)) { sm.Channel.SendMessageAsync("I'm sorry master... I dont have the ability to look for pictures or process commands right... mommy said she'll buy me a laptop around the 21st of november."); } } } } }
Editor is loading...