Exemplo n.º 1
0
        public static void StartBot()
        {
            dclient = new DiscordClient();
            DiscordBot bot = new DiscordBot();

            HttpProcessor processor  = new HttpProcessor(bot);
            Thread        httpThread = new Thread(new ThreadStart(processor.StartProcessor));

            httpThread.Start();

            dclient.MessageReceived += (sender, msg) =>
            {
                if (!msg.Message.IsAuthor)
                {
                    bot.ProcessMessage(sender, msg);
                }
            };

            dclient.Ready += (temp, idontknowwhattheseare) =>
            {
                Console.WriteLine("Ready!");
            };

            dclient.ExecuteAndWait(async() =>
            {
                Console.WriteLine("Starting Discord Bot...");
                await dclient.Connect(discordToken, TokenType.Bot);
            });
        }
Exemplo n.º 2
0
 public HttpProcessor(DiscordBot givenBot)
 {
     usingBot = givenBot;
     listener = new HttpListener();
     listener.Prefixes.Add("http://+:1337/");
 }