Esempio n. 1
0
        public async Task MainAsync()
        {
            FileManager = new FileManager();
            Random      = new Random();
            Config      = FileManager.GetConfig();

            //rcon client setup
            Rcon = new RconArkClient();
            foreach (Config_Server element in Config.Servers)
            {
                await Rcon.AddConnection(element.Name, element.Address, element.RconPort, element.Password, element.Timeout);
            }

            //bot setup configuration
            Bot = new DiscordClient(new DiscordConfiguration()
            {
                Token         = Config.Token,
                TokenType     = TokenType.Bot,
                AutoReconnect = true,
            });

            var services = ConfigureServices();

            //commands setup configuration
            var ccfg = new CommandsNextConfiguration
            {
                StringPrefixes      = new[] { Config.Prefix },
                EnableDms           = true,
                EnableMentionPrefix = true,
                Services            = services,
                EnableDefaultHelp   = false
            };

            Commands = Bot.UseCommandsNext(ccfg);

            //register commands
            Commands.RegisterCommands <KickCommand>();

            //await services.GetRequiredService<KickManager>().InitializeAsync();

            //login
            await Bot.ConnectAsync();

            await Task.Delay(Timeout.Infinite);
        }
Esempio n. 2
0
 public KickCommand(RconArkClient rconArkClient, Config config, Random random)
 {
     Rcon   = rconArkClient;
     Config = config;
     Random = random;
 }