public async Task StartAsync(CancellationToken cancellationToken) { _logger.LogDebug("Test guild: '{Id}'", _settings.Value.TestGuildId); _handlers = _gateway.AddEventHandler(Event.GuildCreate, async(Guild guild) => { var sb = new StringBuilder(); sb.AppendLine($"New guild '{guild.Name}'"); sb.AppendLine("Channel list"); foreach (var channel in guild.Channels) { sb.AppendLine($"\t'{channel.Name}', type '{channel.Type}'"); } var members = await _api.GetAsync <GuildMember[]>($"/guilds/{guild.Id}/members?limit=500", cancellationToken); sb.AppendLine("User list"); if (members is not null) { foreach (var member in members) { var user = member.User; if (user is not null) { sb.AppendLine($"\t'{user.Username}#{user.Discriminator}', joined at '{member.JoinedAt}'"); } else { sb.AppendLine($"\tUNKNOWN USER, joined at '{member.JoinedAt}'"); } } } else { sb.AppendLine("\t-"); } _logger.LogInformation(sb.ToString()); if (guild.Id != _settings.Value.TestGuildId) { return; } // This is the test guild, add a command! var helloWorldCommand = new ApplicationCommand { Name = "hello", Description = "My first slash command!", Type = ApplicationCommandType.ChatInput }; }); }