Exemple #1
0
        public static async Task InitBot(ConnectionConfig config)
        {
            Header();
            Logger.Warn("Loading TSQB...");
            _tsClient = new TeamSpeakClient(config.Ip, config.QueryPort);
            try
            {
                await _tsClient.Connect();

                await _tsClient.Login(config.QueryLogin, config.QueryPassword);

                await _tsClient.UseServer(config.ServerId);

                await _tsClient.ChangeNickName(config.QueryNickname);

                await _tsClient.RegisterServerNotification();

                await _tsClient.RegisterTextPrivateNotification();

                await _tsClient.RegisterChannelNotification(0);

                await EventsManager.HandleEvents(_tsClient);

                await CommandsManager.HandleCommands(_tsClient);

                Logger.Info("Welcome abort captain, all systems online.");
                await KeepAlive();
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex, "An error has been detected!");
                Environment.Exit(-1);
            }
        }