Esempio n. 1
0
        private async Task Client_GuildAvailable(GuildCreateEventArgs e)
        {
            LogMessage?.Invoke(this, $"Guild {e.Guild.Name} is now available");
            _telemetryClient?.TrackEvent($"GuildAvailable", new Dictionary <string, string> {
                { "id", e.Guild.Id.ToString() }, { "name", e.Guild.Name }
            });

            _config.SeenGuilds.Add(e.Guild.Id);
            if (_config.DisallowedGuilds.Contains(e.Guild.Id))
            {
                DiscordChannel c = await InternalTools.GetFirstChannelAsync(e.Guild);

                await c.SendMessageAsync(":middle_finger:");

                await e.Guild.LeaveAsync();
            }
        }
Esempio n. 2
0
        private async Task Client_GuildCreated(GuildCreateEventArgs e)
        {
            LogMessage?.Invoke(this, $"Guild {e.Guild.Name} has been added!");
            _telemetryClient?.TrackEvent($"GuildJoin", new Dictionary <string, string> {
                { "id", e.Guild.Id.ToString() }, { "name", e.Guild.Name }
            });

            if (_config.DisallowedGuilds.Contains(e.Guild.Id))
            {
                DiscordChannel c = await InternalTools.GetFirstChannelAsync(e.Guild);

                await c.SendMessageAsync(":middle_finger:");

                await e.Guild.LeaveAsync();
            }
            else
            {
                await InternalTools.SendWelcomeMessage(e.Guild, _config);
            }
        }