Exemplo n.º 1
0
        private void HookClientEvents()
        {
            bot.Ready += async() =>
            {
                try
                {
                    await lavaClient.StartAsync(bot);

                    lavaClient.OnTrackFinished += services.GetService <AudioService>().OnFinished;

                    await bot.SetGameAsync(Global.Config.Bot.Status);

                    await new DatabaseManager(Global.Config.MongoURI).UpdateCommands(new CommandHelp());
                }
                catch (Exception ex) { await Debug.LogCriticalAsync(ex.Source, ex.Message); }
            };

            bot.JoinedGuild += async(SocketGuild socketGuild) =>
            {
                var newGuild = await Guilds.GetAsync(socketGuild);

                var channel = socketGuild.SystemChannel ?? socketGuild.DefaultChannel;

                var embed = new EmbedBuilder();
                embed.WithTitle($"Hi, I'm {bot.CurrentUser.Username}!");
                embed.AddField("⚙️ Config", $"Customize me to your server's needs at {Global.Config.DashboardURL}/servers/{socketGuild.Id}", inline: true);
                embed.AddField("📜 Commands", $"Type {newGuild.General.CommandPrefix}help for a list of commands.", inline: true);
                embed.AddField("❔ Support", $"Need help with {bot.CurrentUser.Username}? Join our Discord for more support: {Global.Config.DashboardURL}/support", inline: true);

                await channel.SendMessageAsync(embed : embed.Build());
            };
        }
Exemplo n.º 2
0
 private async Task ClientReadyAsync()
 {
     await _lavaSocketClient.StartAsync(_client, new Configuration
     {
         LogSeverity = LogSeverity.Info
     });
 }
Exemplo n.º 3
0
        private async Task OnReady()
        {
            await _lavaClient.StartAsync(_client);

            _lavaClient.OnTrackException += OnTrackException;
            _lavaClient.OnTrackStuck     += OnTrackStuck;
            _lavaClient.OnTrackFinished  += OnTrackFinished;
        }
Exemplo n.º 4
0
 private async Task ClientReadyAsync() =>
 await _lavaSocketClient.StartAsync(_client,
                                    new Configuration
 {
     AutoDisconnect    = true,
     InactivityTimeout = TimeSpan.FromSeconds(30),
     LogSeverity       = LogSeverity.Verbose
 });
Exemplo n.º 5
0
        private async Task Discord_Ready()
        {
            _lavaLink.Log              += _lavaLink_Log;
            _lavaLink.OnPlayerUpdated  += OnPlayerUpdated;
            _lavaLink.OnServerStats    += OnServerStats;
            _lavaLink.OnSocketClosed   += OnSocketClosed;
            _lavaLink.OnTrackException += OnTrackException;
            _lavaLink.OnTrackFinished  += OnTrackFinished;
            _lavaLink.OnTrackStuck     += OnTrackStuck;

            await _lavaLink.StartAsync(_discord, new Configuration
            {
                LogSeverity       = LogSeverity.Debug,
                ReconnectAttempts = 3,
                Port = 2333,
            });
        }
Exemplo n.º 6
0
        public async Task OnReady()
        {
            _databaseHandler.VerifyGuilds(_socketClient.Guilds.Select(x => x.Id));
            await _jobHandler.InitializeAsync();

            await _lavaSocketClient.StartAsync(_socketClient, new Configuration
            {
                LogSeverity       = LogSeverity.Warning,
                ReconnectAttempts = 5,
                ReconnectInterval = TimeSpan.FromSeconds(3)
            });

            var collection = _databaseHandler.GetCollection <CaseEntity>();

            foreach (var guild in _socketClient.Guilds)
            {
                var guildEntity = _databaseHandler.Get <GuildEntity>(guild.Id);
                _roleReactionHandler.InitForGuild(guild, guildEntity);
                CreateGitHubListenerForGuild(guild, guildEntity);
                await CheckCaseEntities(guild, collection);
            }
        }
Exemplo n.º 7
0
 private async Task ClientReadyAsync()
 {
     await lavaSocketClient.StartAsync(client);
 }