public static void Main(string[] args)
        {
            string token = "";

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].Equals("-t", StringComparison.CurrentCulture))
                {
                    token = args[i + 1];
                }
            }

            if (token == "")
            {
                Console.Write("Please enter token: ");
                token = Console.ReadLine();
            }

            AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
            {
                Logger.Log(Level.Error, "An error has occured", (Exception)eventArgs.ExceptionObject);
            };

            DiscordBot bot = new DiscordBot();

            bot.Login(token).GetAwaiter().GetResult();
        }
Example #2
0
 public static async Task BotSetup(DiscordBot.BotCredentials credentials)
 {
     try
     {
         var token = ConfigurationManager.AppSettings["Bot.Token"];
         await DiscordBot.Client.Connect(token);                           
         DiscordBot.Client.CurrentUser.Edit(credentials.Password, credentials.BotName).Wait();
         DiscordBot.Client.SetGame(credentials.Game);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }