private async Task ServerSetup(ParseResult result, IMessageCreatedEvent context) { if (context.Guild != null) { await context.Respond("Server already active"); return; } if (context is DiscordMessageCreatedEvent dmce) { var message = dmce.@event; DiscordGuild discord_guild = message.Guild; var member = await message.Guild.GetMemberAsync(message.Message.Author.Id); var permissions = member.PermissionsIn(message.Message.Channel); if (permissions.HasPermission(Permissions.Administrator) || member.Id.ToString() == config.Value.Owner) { Guild?guild = (from g in context.Db.Guilds where g.GuildID == discord_guild.Id select g).FirstOrDefault(); if (guild == null) { logger.Information($"Registering guild: {discord_guild.Id}"); context.Db.Add(new Guild(discord_guild.Name, discord_guild.Id.ToString())); context.Db.SaveChanges(); var embed = new DSharpPlus.Entities.DiscordEmbedBuilder() { Description = "Server setup complete!" }; await message.Message.RespondAsync(embed : embed.Build()); } } else { await message.Message.RespondAsync("You do not have the permission"); } } }