Exemple #1
0
        private void InitializeDiscordClient()
        {
            // initialize DiscordClient for each bot token in config
            foreach (var token in Config.INSTANCE.bot_tokens)
            {
                // initialize client
                var client = new DiscordClient(new DiscordConfigBuilder()
                {
                }.Build());

                // command settings
                client.UsingCommands(x => {
                    x.PrefixChar = '!';
                    x.HelpMode   = HelpMode.Public;
                });

                // set up event handlers
                client.UserJoined      += (sender, e) => OnUserJoined(sender, e, client);
                client.ServerAvailable += (sender, e) => CMDDisplay.OnServerAvailable(sender, e, client);

                // initialize modules for client
                InitializeModules(client);

                // connect bot client to discord
                client.Connect(token, TokenType.Bot);
                clients.Add(client);
            }
        }
Exemple #2
0
 public void Start()
 {
     InitializeDiscordClient();
     CMDDisplay.Start();
 }