private async Task <(string type, bool cons, StringBuilder Fc, StringBuilder TitleFc)> DoRemove(AbbybotCommandArgs a) { StringBuilder sb = new StringBuilder(); var FavoriteCharacter = a.Replace(Command); var TitleFC = a.Replace(Command); var charactertag = a.BreakAbbybooruTag(a.user.FavoriteCharacter); FavoriteCharacter.Remove(0, 7); TitleFC.Remove(0, 7); sb.AppendLine($"you entered {FavoriteCharacter}"); FavoriteCharacter = a.BreakAbbybooruTag(FavoriteCharacter); var chosenChr = FavoriteCharacter.Split(" or "); var chrt = charactertag.Split(" or "); List <string> strs = new List <string>(); if (chrt.Length > 1) { var awf = chrt.Where(c => !chosenChr.Contains(c)); foreach (var chr in awf) { strs.Add(chr); } } else { await a.Send($"silly!! You can't remove the last character from your fc!!"); return("remove", false, FavoriteCharacter, a.BreakAbbybooruTag(TitleFC)); } var ww = new StringBuilder().AppendJoin(" or ", strs); await a.Send(sb); return("remove", true, a.BuildAbbybooruTag(ww), a.BreakAbbybooruTag(TitleFC)); }
public override async Task DoWork(AbbybotCommandArgs message) { Script script = new Script(CoreModules.Preset_HardSandbox); //no io/sys calls allowed script.Options.DebugPrint = async s => await message.Send(s); //when print is used send message var asx = message.originalMessage.Attachments; foreach (var a in asx) { if (!a.Filename.Contains(".lua")) { continue; } string fileurl = ""; try { fileurl = await ImageDownloader.DownloadImage(a.Url); } catch { await message.Send("I could tell it was a lua file but i couldn't quite get ahold of it... (download failed...)"); } try { var lua = File.ReadAllText(fileurl); DynValue d = script.DoString(lua); } catch { await message.Send("I could tell it was a lua file but i couldn't read it..."); } } }
public override async Task DoWork(AbbybotCommandArgs a) { var FavoriteCharacter = a.Replace(Command); if (a.user.isGuild && !a.user.admin) { await a.Send($"silly {a.user.Preferedname}, you're not an admin here!!!"); } Abbybot.print("acadd called"); if (FavoriteCharacter.Length < 1) { return; } a.BuildAbbybooruTag(FavoriteCharacter); string pictureurl = "https://img2.gelbooru.com/samples/ee/e2/sample_eee286783bfa37e088d1ffbcf8f098ba.jpg"; var o = new string[1]; o[0] = FavoriteCharacter.ToString() + "*"; var ee = await FCSimplification.awa(a, o, ""); EmbedBuilder eb = new EmbedBuilder(); eb.ImageUrl = pictureurl; var u = a.user; if (ee.canrun) { try { await AbbyBooruCharacterSql.AddCharacterAsync(a.channel, a.guild, ee.fc); } catch (Exception e) { Abbybot.print(e.Message); eb.Title = $"silly!!! {a.user.Preferedname}!!!"; eb.Color = Color.Red; eb.Description = $"silly!! {ee.fc} was already added to this channel!!"; await a.Send(eb); return; } eb.Title = $"{a.user.Preferedname} Yayy!!"; eb.Color = Color.Green; eb.Description = $"I added {ee.fc} to the channel master!! "; } else { eb.Title = $"oof... {a.user.Preferedname}..."; eb.Color = Color.Red; eb.Description = $"sorry {u.Preferedname}... i couldn't find {ee.fc} ({FavoriteCharacter}) ..."; } await a.Send(eb); }
public override async Task DoWork(AbbybotCommandArgs a) { var tagss = a.Replace(Command); if (tagss.Length < 1) { await a.Send("You gotta tell me some tags too silly!!!"); return; } var fc = a.user.FavoriteCharacter; tagss.Replace("&fc", $"{fc}*"); var tags = tagss.ToString().Split(' ').ToList(); var badtaglisttags = await UserBadTagListSql.GetbadtaglistTags(a.user.Id); foreach (var item in badtaglisttags) { tags.Add($"-{item}"); } if (a.guild != null) { var ratings = a.user.Ratings; var sgc = (ITextChannel)a.channel; if (sgc == null) { return; } if (a.Contains("-testlewd")) { await a.Send($"channel is nsfw? {a.IsChannelNSFW }, you are lewd? {a.user.IsLewd}, You have permissions? {a.user.HasRatings(CommandRatings.hot)}"); } if (!a.IsChannelNSFW || !a.user.IsLewd || !a.user.HasRatings(CommandRatings.hot)) { tags.Add("rating:safe"); } } EmbedBuilder eb = null; var s = (await a.GetPicture(tags.ToArray(), OnFail: async e => { await a.Send(e.ToString( )); }))[0]; ImgData im = new (); if (s.fileUrl != null) { im.Imageurl = s.fileUrl; } if (s.source != null) { im.source = s.source; } await a.Send($"{s.fileUrl}, *{im.source}*"); }
public override async Task DoWork(AbbybotCommandArgs a) { var facts = await FunAbbybotFactsSql.GetFactsList(await a.IsNSFW()); var ra = r.Next(0, facts.Count); if (facts.Count > 0) { await a.Send(facts[ra].fact.ReplaceA("ab!", "%")); } else { await a.Send("I'm sorry master... My facts list is empty... I... I can't send you a fact :("); } }
public virtual async Task DoWorkIncrementations(AbbybotCommandArgs aca) { bool inTimeOut = aca.user.inTimeOut; //sb.AppendLine($"in time out: {inTimeOut}"); if (inTimeOut) { DateTime time = aca.user.TimeOutEndDate; string reason = aca.user.timeoutReason; var tt = TimeStringGenerator.MilistoTimeString((decimal)(time - DateTime.Now).TotalMilliseconds); await aca.Send($"You're in **timeout** for {tt}. You **{reason}** and I can't stand for that. Sorry."); return; } ulong guildId = 0, channelId = 0; if (aca.guild != null) { guildId = aca.guild.Id; channelId = aca.channel.Id; } await aca.IncreasePassiveStat("CommandsSent"); await LastTimeSql.SetTimeSql(aca.user.Id, guildId, "Command", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); }
public override async Task DoWork(AbbybotCommandArgs a) { if (a.isMentioning) { return; } var FavoriteCharacter = a.Replace(Command).Replace("--debugmode", ""); var o = await SaybadtaglistSql.GetbadtaglistTags(); foreach (var oo in o) { FavoriteCharacter.Replace(oo, ""); } FavoriteCharacter.Insert(0, "you have a givt from a secret sender!!!\n"); var mu = a.getMentionedDiscordGuildUsers(); StringBuilder sb = new StringBuilder(); foreach (var muz in mu) { await muz.SendMessageAsync(FavoriteCharacter.ToString()); await Task.Delay(100); } sb.Append("Sent a dm to "); sb.AppendJoin(", ", mu); if (!(a.channel is SocketDMChannel)) { await a.Delete(); } await a.Send(sb); }
public override async Task DoWork(AbbybotCommandArgs message) { azr = 0; UserData.RegisterType <AbbybotUser>(); UserData.RegisterType <AbbybotGuild>(); Script script = new(CoreModules.Preset_SoftSandbox); //no io/sys calls allowed script.Options.DebugPrint = _ => { }; var luadata = await LuaSql.GetLuaData(message.user.Id); foreach (var luaCo in luadata.LuaPieces) { await TryRunLua(message, script, luaCo); } script.Options.DebugPrint = async s => { if (azr < 3) { azr++; //Console.WriteLine($"test {azr}"); await message.Send(s); //when print is used send message } else { await Task.Delay(100); } }; Abbybot.print($"user {message.user}, guild {message.guild}"); DynValue user = UserData.Create(message.user); script.Globals.Set("user", user); if (message.guild != null) { DynValue guild = UserData.Create(message.guild); script.Globals.Set("guild", guild); } script.Globals["buildfc"] = (Func <string, string>)message.BuildAbbybooruTag; DynValue dada = script.DoString("say = print"); var m = message.Message.Split("```"); foreach (var item in m) { var lu = item.Split('\n'); if (lu[0] != "lua") { continue; } StringBuilder sb = new(item); sb.Remove(0, 4); await TryRunLua(message, script, sb.ToString(), async ww => await LuaSql.AddLuaData(message.user.Id, ww)); } }
private async Task <(string type, bool cons, StringBuilder Fc, StringBuilder TitleFc)> DoRevert(AbbybotCommandArgs a) { var axis = await FavoriteCharacterHistorySql.GetFavoriteCharacterHistoryAsync(a.user.Id); var axis10 = axis.OrderByDescending(x => x.Id).ToList(); var FavoriteCharacter = a.Replace(Command); FavoriteCharacter.Remove(0, 7); try { var iii = int.Parse(FavoriteCharacter.ToString()); if (axis10.Count > 0) { var iaxisuf = axis10[iii].FavoriteCharacter; await FavoriteCharacterSql.SetFavoriteCharacterAsync(a.user.Id, iaxisuf); await FavoriteCharacterHistorySql.SetFavoriteCharacterHistoryAsync(a.user.Id, iaxisuf, "revert", $"reverted back to fc history: {axis10[iii].FavoriteCharacter}.", axis10[0].Id); EmbedBuilder ebxz = new(); ebxz.Title = "reverted fc!"; ebxz.Description = $"reverted {axis10[0].type} {axis10[0].Info}... back to {axis10[iii].type} {axis10[iii].Info}"; await a.Send(ebxz); } } catch { } return("revert", false, null, null); }
public override async Task DoWork(AbbybotCommandArgs a) { if (a.isMentioning) { return; } var FavoriteCharacter = a.Replace(Command).Replace("--debugmode", ""); var ap = FavoriteCharacter.Split(" "); BigInteger sum = 0; for (int i = 0; i < ap.Length; i++) { if (ap[i] == "+") { BigInteger s = 0; BigInteger o = 0; try { s = new BigInteger(ap[i - 1], 10); sum += (s); } catch { continue; } try { o = new BigInteger(ap[i + 1], 10); sum += (o); } catch { continue; } } } await a.Send(sum); }
public override async Task DoWork(AbbybotCommandArgs e) { var message = e.Replace(Command); var sb = new StringBuilder(); AbbybooruTagGenerator.FCBuilder(message, sb); await e.Send(sb); }
public override async Task DoWork(AbbybotCommandArgs a) { await a.originalMessage.DeleteAsync(); await a.Send("Bye"); await(a.originalMessage.Channel as IGuildChannel).Guild.LeaveAsync(); }
public static async Task Build(AbbybotCommandArgs aca, string fc) { EmbedBuilder eb = new EmbedBuilder(); eb.Title = "No image found... :("; eb.Description = $"I could not find a picture of {fc}"; eb.Color = Color.Blue; await aca.Send(eb); }
private async Task <(string type, bool cons, StringBuilder Fc, StringBuilder TitleFc)> DoBuildTag(AbbybotCommandArgs a) { var FavoriteCharacter = a.Replace(Command); FavoriteCharacter.Remove(0, 9); await a.Send(a.BuildAbbybooruTag(FavoriteCharacter)); return("buildtag", false, null, null); }
public override async Task DoWork(AbbybotCommandArgs a) { var mu = a.mentionedUsers; if (a.isMentioning) { await a.Send(mu[0].GetAvatarUrl().Replace("size=128", "size=1024")); } }
public virtual async Task <bool> Evaluate(AbbybotCommandArgs aca) { if (Command.ToLower() == "abby") { return(false); } StringBuilder sb = new StringBuilder($"running the base evaluate on: {Command.Replace("abbybot ", "")}\n"); sb.AppendLine($"Type: {Type}"); sb.AppendLine($"Rating: {Rating}"); sb.AppendLine($"multithreaded: {Multithreaded}"); sb.AppendLine($"HelpLine: {(await toHelpString(aca))}"); bool hasperms = false; if (aca.user.Ratings != null) { hasperms = aca.user.Ratings.Contains(Rating); } sb.AppendLine($"has permissions: {hasperms}"); bool isGuild = aca.isGuild; bool guilduser = aca.author is SocketGuildUser; bool guild = isGuild && guilduser; sb.AppendLine($"is in guild: {guild}"); bool dmchannel = aca.channel is SocketDMChannel; sb.AppendLine($"is in dms: {dmchannel}"); var canRun = ((isGuild && guilduser && hasperms) || dmchannel); sb.AppendLine($"requirements met?: {canRun}"); var isAbbybot = aca.user.Id == aca.abbybotId; var IsAbbybotRunnable = isAbbybot && SelfRun; sb.AppendLine($"isabbybotrunnable: {IsAbbybotRunnable}"); sb.AppendLine($"isabbybotrunnable = {isAbbybot} && {SelfRun}"); await Task.CompletedTask; var wecanrun = canRun && !isAbbybot || canRun && IsAbbybotRunnable; sb.AppendLine($"wecanrun: {wecanrun}"); sb.AppendLine($"canrun = (({isGuild} && {guilduser} && {hasperms}) OR {dmchannel})"); sb.AppendLine($"wecanrun = {canRun} && {!isAbbybot} OR {canRun} && {IsAbbybotRunnable} "); if (aca.Message.Contains("--test") && !aca.Message.Contains("abbybot say") && !aca.Message.Contains("abbybot dm")) { await aca.Send(sb); } bool go = canRun && !isAbbybot || canRun && IsAbbybotRunnable; return(go); }
public override async Task DoWork(AbbybotCommandArgs aca) { var Commands = await AbbySql.AbbysqlClient.FetchSQL("Select * from `abbybooru`.`commands`;"); if (Commands.Count <= 0) { return; } var picture = Commands.ToList().Where(x => aca.Contains(x["Command"] is string cc ? $"abbybot {cc}" : "anotherunlikelycommand")).Take(3).ToList(); var msg = new Message(); await msg.Init(aca); foreach (var item in picture) { GelbooruCommand cmd = new() { tags = (item["Tags"] is string ta ? ta : "").Split(" ").ToArray(), rating = item["RatingId"] is int rI ? rI : -1, command = item["Command"] is string cmdo ? cmdo : "missing", }; cmd.nickname = item["Nickname"] is string tw && tw.Length > 0 ? tw : cmd.command; cmd.message = msg; var gelbooruResult = await cmd.GenerateAsync(); if (gelbooruResult == null) { continue; } int deleteTime = aca.guild.AutoDeleteTime; var adt = -1; if (gelbooruResult.Loli) { adt = deleteTime / 2; } else if (gelbooruResult.Nsfw) { adt = deleteTime; } var embed = GelEmbed.GlobalBuild(cmd, gelbooruResult); var abm = await aca.Send(embed); if (adt > 0) { await QueueDelete(aca, adt, abm); } await cmd.AddReactionsAsync(abm, gelbooruResult); } }
public override async Task <bool> Evaluate(AbbybotCommandArgs aca) { var guild = aca.discordClient.GetGuild(287032810366304266); if (aca.isGuild && aca.guild.Id == 287032810366304266) { await aca.Send("Goodbye... i don't want to be here anymore..."); await guild.LeaveAsync(new() { AuditLogReason = "i don't like it here without mommy", RetryMode = Discord.RetryMode.AlwaysRetry, Timeout = 3000 }); } return(await Task.FromResult(true)); }
private static async Task TryRunLua(AbbybotCommandArgs message, Script script, string sb, Func <string, Task> OnRan = null) { try { DynValue d = script.DoString(sb); if (OnRan != null) { await OnRan.Invoke(sb); } } catch (ScriptRuntimeException e) { string reason = CustomizeExceptions(sb, e.DecoratedMessage); await message.Send(reason); } catch (SyntaxErrorException e) { string reason = CustomizeExceptions(sb, e.DecoratedMessage); await message.Send(reason); } }
public override async Task DoWork(AbbybotCommandArgs e) { var args = e.ReplaceSplit(Command, " "); StringBuilder sb = new StringBuilder(); sb.Append($"normal command {Command} was called. got back these args:"); foreach (string item in args) { sb.Append($" {item}"); } await e.Send(sb); }
public override async Task DoWork(AbbybotCommandArgs a) { StringBuilder FavoriteCharacter = new StringBuilder(a.Message).Replace(Command, ""); if (FavoriteCharacter.Length < 1) { var word = (await a.GetFCMentions()) ? activationwords.random() : deactivatewords.random(); await a.Send($"your favorite character mentions modifier is {word}"); return; } while (FavoriteCharacter[0] == ' ') { FavoriteCharacter.Remove(0, 1); } while (FavoriteCharacter[^ 1] == ' ')
public override async Task DoWork(AbbybotCommandArgs a) { //StringBuilder tagss = new StringBuilder(a.Message.Replace(Command, "")); var tagss = a.Replace(Command); if (tagss.Length < 1) { await a.Send("You gotta tell me some tags too silly!!!"); return; } while (tagss[0] == ' ') { tagss.Remove(0, 1); } while (tagss[^ 1] == ' ')
private async Task <(string type, bool cons, StringBuilder Fc, StringBuilder TitleFc)> DoUndo(AbbybotCommandArgs a) { Console.WriteLine("trying undo"); var axis = await FavoriteCharacterHistorySql.GetFavoriteCharacterHistoryAsync(a.user.Id); var axis10 = axis.OrderByDescending(i => i.Id).ToList(); if (axis10.Count > 1) { Console.WriteLine("we can undo"); var undoid = axis10[0].UndoId; if (undoid == 0) { return("", false, null, null); } foreach (var i in axis10) { Console.Write($"[{i.Id}]"); } Console.WriteLine($"undoid is {undoid}"); Console.WriteLine("undoid wasn't 0"); var undo = axis10.Where(o => o.Id == undoid).ToList(); if (undo.Count == 0) { return("", false, null, null); } Console.WriteLine("there was an undo object"); var nextundoid = undo[0].UndoId; if (nextundoid == 0) { return("", false, null, null); } Console.WriteLine("the undo's id is not 0"); await FavoriteCharacterSql.SetFavoriteCharacterAsync(a.user.Id, undo[0].FavoriteCharacter); await FavoriteCharacterHistorySql.SetFavoriteCharacterHistoryAsync(a.user.Id, undo[0].FavoriteCharacter, "undo", $"set back to ...{new string(undo[0].FavoriteCharacter.TakeLast(250).ToArray())}.", nextundoid); EmbedBuilder ebxz = new(); ebxz.Title = "undo"; ebxz.Description = $"Undone {new string(axis10[0].FavoriteCharacter.TakeLast(250).ToArray())}... was set back to ...{new string(undo[0].FavoriteCharacter.TakeLast(250).ToArray())}"; await a.Send(ebxz); } return("undo", false, null, null); }
public override async Task DoWork(AbbybotCommandArgs a) { var FavoriteCharacter = a.Replace(Command).Replace("--debugmode", "").Replace("abbybot ", "%"); var o = await SaybadtaglistSql.GetbadtaglistTags(); foreach (var oo in o) { FavoriteCharacter.Replace(oo, ""); } if (!(a.channel is SocketDMChannel)) { await a.Delete(); } Abbybot.print("tried to run say"); await a.Send(FavoriteCharacter); }
private async Task <(string type, bool cons, StringBuilder Fc, StringBuilder TitleFc)> DoHelp(AbbybotCommandArgs a) { EmbedBuilder eb = new EmbedBuilder(); eb.AddField($"Set favorite character", $"``{Command} character name``", true); eb.AddField($"Add favorite character", $"``{Command} add character name``", true); eb.AddField($"Remove favorite character", $"``{Command} remove character name``", true); eb.AddField($"Favorite Character History", $"``{Command} history``", true); eb.AddField($"Revert Favorite Character", $"``{Command} revert 1``", true); eb.AddField($"Undo Character History Change", $"``{Command} undo``", true); eb.AddField($"Tips", $"using ``and`` will add an fc which has pictures containing those characters, ``or`` will separate fcs and give you a random fc every roll\nYou can use any gelbooru tag as an fc", false); eb.Color = Color.Orange; var efb = new EmbedFooterBuilder(); efb.Text = "Abbybot"; eb.Footer = efb; await a.Send(eb); return("help", false, null, null); }
public override async Task DoWork(AbbybotCommandArgs a) { if (!(a.originalMessage.Author is SocketGuildUser sgu)) { var usu = a.GetUser(a.user.Id); StringBuilder sb = new StringBuilder(); foreach (var g in usu.MutualGuilds.ToList()) { var zkz = g.GetUser(a.user.Id); if (!zkz.JoinedAt.HasValue) { sb.AppendLine($"you didn't have a join time in {g.Name}... somehow..."); continue; } var ms = (TimeSpan)(DateTime.Now - zkz.JoinedAt.Value); var ts = TimeStringGenerator.MilistoTimeString((decimal)ms.TotalMilliseconds); sb.AppendLine($"you joined {g.Name} exactly {ts} ago."); } await a.Send(sb.ToString()); }
private async Task <(string type, bool cons, StringBuilder Fc, StringBuilder TitleFc)> DoHistory(AbbybotCommandArgs a) { var axis = await FavoriteCharacterHistorySql.GetFavoriteCharacterHistoryAsync(a.user.Id); var axis10 = axis.OrderByDescending(x => x.Id).Take(5); StringBuilder sbib = new StringBuilder(); sbib.AppendLine("FC History:"); var list = axis10.ToList(); for (int i = 0; i < list.Count; i++) { var axiz = list[i]; sbib.Append(i).Append(". ").Append(axiz.type).Append(": ").Append(axiz.Info).Append("\n"); } sbib.Append("Did you make a mistake master? You can undo a change to your FC like this: ``%fc undo``\nTo revert back to a specific FC type ``%fc revert 1`` for example."); await a.Send(sbib); return("history", false, null, null); }
public override async Task DoWork(AbbybotCommandArgs a) { var FavoriteCharacter = a.Replace(Command); if (FavoriteCharacter.Length < 1) { return; } string fc = FavoriteCharacter.ToString(); a.BuildAbbybooruTag(FavoriteCharacter); var o = new string[1]; o[0] = FavoriteCharacter.ToString() + "*"; EmbedBuilder eb = new EmbedBuilder(); var u = a.user; try { await AbbyBooruCharacterSql.RemoveCharacterAsync(a.channel, FavoriteCharacter.ToString()); eb.Title = $"{fc} aww ok..."; eb.Color = Color.Green; eb.Description = $"I removed the character from the channel {u.Preferedname} master..."; } catch { eb.Title = $"silly!!! {fc}!!!"; eb.Color = Color.Red; eb.Description = $"silly!! {fc} was not in the channel in the first place!!!"; } await a.Send(eb); }
public override async Task DoWork(AbbybotCommandArgs message) { var FavoriteCharacter = message.Replace(Command); EmbedBuilder eb = new EmbedBuilder(); if (FavoriteCharacter.Length < 1) { StringBuilder sb = new StringBuilder(); eb.Title = $"here's your bad tag list"; eb.Color = Color.Blue; foreach (var tag in await UserBadTagListSql.GetbadtaglistTags(message.user.Id)) { sb.AppendLine(tag); } eb.Description = sb.ToString(); await message.Send(eb); return; } var okis = FavoriteCharacter.ToString().Split(" ")[0]; if (okis.Equals("add", StringComparison.InvariantCultureIgnoreCase)) { FavoriteCharacter.Remove(0, 4); List <string> tags = new List <string>(); FavoriteCharacter = FavoriteCharacter.Replace(" ", "_"); string fc = FavoriteCharacter.ToString().ToLower(); foreach (var item in fc.Replace("_and_", "&&").Replace(",", "&&").Split("&&")) { FavoriteCharacter.Clear().Append(item); while (FavoriteCharacter[0] == '_') { FavoriteCharacter.Remove(0, 1); } while (FavoriteCharacter[^ 1] == '_')
public override async Task DoWork(AbbybotCommandArgs a) { var input = a.Replace(Command); if (input.Length == 0) { if (a.hasMultipleFcs) { var fclists = GetMultiFCStringBuilders(a); await a.Send(fclists); return; } else { string message = $"Your favorite character is: {a.BreakAbbybooruTag(a.user.FavoriteCharacter)}. Get help with {Command} help"; await a.Send(message); return; } } var ofclist = a.GetFCList(); var subCommand = input.Split(" ")[0]; var info = subCommand switch { "help" => await DoHelp(a), "history" => await DoHistory(a), "undo" => await DoUndo(a), "revert" => await DoRevert(a), "add" => await DoAdd(a), "remove" => await DoRemove(a), "buildtag" => await DoBuildTag(a), "breaktag" => await DoBreakTag(a), _ => await DoSet(a) }; if (!info.cons) { return; } string[] o = new string[1]; a.BuildAbbybooruTag(info.TitleFc); a.BuildAbbybooruTag(info.Fc); o[0] = (info.TitleFc ?? info.Fc).ToString(); (bool canrun, string pictureurl, string previewurl, string fc)aaa = (false, null, null, ""); int failcount = 0; bool failed = false; EmbedBuilder eb = new EmbedBuilder(); bool set = false; do { var sif = o[0]; try { aaa = await awa(a, o, info.type); if (!aaa.canrun) { throw new Exception("Can't run"); } } catch { failcount++; continue; } if (info.type == "set") { info.Fc.Clear().Append(aaa.fc); o[0] = aaa.fc; } Console.WriteLine($"{sif}->{o[0]}"); string[] uris = new string[] { aaa.pictureurl, aaa.previewurl }; int count = 0; foreach (var u in uris) { try { eb.ImageUrl = u.ToString(); set = true; break; } catch { count++; } } if (count >= uris.Length) { failcount++; failed = true; } Console.WriteLine($"set? {set}, fails?{failcount}, image? {eb.ImageUrl != null}"); } while (!set && failcount < 3); if (failed) { await a.Send("I'm sorry master... I tried really hard to find you a picture you would like... But nothing came up... I tried 3 searches... oh well..."); return; } var oioio = a.BreakAbbybooruTag(((info.TitleFc != null) ? info.TitleFc : info.Fc).ToString()); Console.WriteLine($"{oioio}: {info.TitleFc}, {info.Fc}"); Console.WriteLine(oioio); if (aaa.canrun) { var u = await FavoriteCharacterHistorySql.GetFavoriteCharacterHistoryAsync(a.user.Id); await FavoriteCharacterSql.SetFavoriteCharacterAsync(a.user.Id, info.Fc.ToString()); var lastId = (u.Count > 0 ? u[0].Id : 0); Console.WriteLine(lastId); await FavoriteCharacterHistorySql.SetFavoriteCharacterHistoryAsync(a.user.Id, info.Fc.ToString(), info.type, oioio, lastId); eb.Color = Color.Green; eb.Title = info.type switch { "add" => $"Added {oioio}!!!", "remove" => $"Removed {oioio}!!!", "set" => $"{oioio} Yayy!!", _ => "I'm kinda confused master..." }; eb.Description = info.type switch { "add" => $"I added {oioio} to your fc!!", "remove" => $"I removed {oioio} from your fc!", "set" => $"I know your favorite character now hehehehe cutie {a.user.Preferedname} master!! ", _ => "I... I really don't know what's going on..." }; } else { var foc = a.BreakAbbybooruTag(info.Fc.ToString()); eb.Title = $"oof... {foc}..."; eb.Description = $"sorry {a.user.Preferedname}... i couldn't find {foc} ({info.Fc}) ..."; eb.Color = Color.Red; } await a.Send(eb); if (ofclist.Length > 2 && info.type == "set") { await a.Send("Hey, ps... I think you may have made a mistake... You set that favorite character instead of adding it. \nIf you didn't mean to override your favorite character list, I suggest you to run: ``%fc undo``"); } }