public async Task <BanAppeal> CreateAppeal(IGuild guild, BotUser user) { var existing = GetAppeal(guild, user.Id); if (existing != null) { return(existing); } var appeals = GetAllAppeals(guild); if (appeals.AppealCategory == null) { appeals.AppealCategory = await guild.CreateCategoryAsync("Ban Appeals", x => { x.PermissionOverwrites = new List <Overwrite>() { new Overwrite(guild.EveryoneRole.Id, PermissionTarget.Role, Program.NoPerms) }; }); } var txt = await guild.CreateTextChannelAsync($"appeal-{user.Name}", x => { x.Topic = user.Id.ToString(); x.CategoryId = appeals.AppealCategory.Id; x.Position = 0; }); var appeal = new BanAppeal(); appeal.Appellant = user; appeal.Guild = guild; appeal.AppealChannel = txt; appeals.Appeals[user.Id] = appeal; OnSave(); await txt.SendMessageAsync(embed : new EmbedBuilder() .WithAuthor(user.Name, user.GetAvatarUrl()) .WithTitle($"Ban Appeal") .WithDescription($"Original Ban Reason:\r\n> {(appeal.Ban.Reason ?? "No reason provided")}") .WithFooter($"{Program.Prefix}appeal mute | {Program.Prefix}appeal approve | {Program.Prefix}appeal reject") .WithColor(Color.Red) .Build()); return(appeal); }
protected override void BeforeExecute(CommandInfo command) { Appeal = Service.GetAppeal(Context.Guild, ulong.Parse((Context.Channel as ITextChannel).Topic)); }