public async Task CreateRequest(SocketGuild guild, SocketGuildUser user, string authorName, string title, string text, SupportType supportType, int atLeastAdminLevel, bool fromDiscord) { GuildEntity guildEntity = _databaseHandler.Get <GuildEntity>(guild.Id); if (guildEntity is null) { return; } var categoryId = guildEntity.SupportRequestCategoryId; if (categoryId == 0) { return; } var supportRequestCategory = guild.GetCategoryChannel(categoryId); if (supportRequestCategory is null) { return; } var embed = EmbedHelper.GetSupportRequestEmbed(user, title, text, supportType); var textChannel = await ChannelHelper.CreateSupportChannel(guild, supportType.ToString() + "_discord", categoryId, fromDiscord); await textChannel.AddPermissionOverwriteAsync(user, new OverwritePermissions( viewChannel : PermValue.Allow, sendMessages : PermValue.Allow, readMessageHistory : PermValue.Allow, connect : PermValue.Allow, speak : PermValue.Allow )); if (atLeastAdminLevel > 1 && guildEntity.SupporterRoleId != 0) { await textChannel.DenyAccess(guild, guildEntity.SupporterRoleId); } if (atLeastAdminLevel > 2 && guildEntity.AdministratorRoleId != 0) { await textChannel.DenyAccess(guild, guildEntity.AdministratorRoleId); } var message = await textChannel.SendMessageAsync(user.Mention, embed : embed.Build()); await message.PinAsync(); await user.SendMessageAsync($"Your support request has been sent, a channel has been created:{Environment.NewLine}{message.GetJumpUrl()}"); if (fromDiscord) { var reply = await _tdsClient.SupportRequest.Create(user.Id, title, text, supportType, atLeastAdminLevel); if (int.TryParse(reply, out int requestId)) { await textChannel.ModifyAsync(c => c.Name = supportType.ToString() + "_" + requestId); await user.SendMessageAsync($"The support request was successfully added to TDS-V."); } else { await user.SendMessageAsync($"The support request could not be added to TDS-V." + $"{Environment.NewLine}You either don't have an account yet or have not set your Discord-ID in your settings (correctly)." + $"{Environment.NewLine}If you've set the wrong id: You need to set your ID to '{user.Id}'"); } } }