Attempt at double-gem/coal fix.

-Attempt to fix bug that allows for a message to be gemmed/coaled twice if done fast enough, by having it write the log for the pin earlier.
This commit is contained in:
Brazman 2023-04-13 16:47:55 -05:00
parent e9d7876620
commit ad327b8595

View file

@ -43,7 +43,7 @@ namespace SuperMachoBot
}; };
databasePath = configItems[0].EconomyDatabasePath; databasePath = configItems[0].EconomyDatabasePath;
discord.MessageReactionAdded += async (s, e) => //Spaghetti central. discord.MessageReactionAdded += async (s, e) =>
{ {
try //I don't think this is good practice. Fuck it. try //I don't think this is good practice. Fuck it.
{ {
@ -60,7 +60,7 @@ namespace SuperMachoBot
{ {
string thumbnailURL = GetRelevantEmbedURL(message); string thumbnailURL = GetRelevantEmbedURL(message);
string desc = ""; string desc = "";
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/Pinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
if (message.Content != "") if (message.Content != "")
{ {
desc = $@"""{message.Content}"""; desc = $@"""{message.Content}""";
@ -76,7 +76,6 @@ namespace SuperMachoBot
Color = DiscordColor.PhthaloBlue Color = DiscordColor.PhthaloBlue
}.AddField("Gem:", $"[link]({message.JumpLink})").Build(); }.AddField("Gem:", $"[link]({message.JumpLink})").Build();
await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, bruhgimus); await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, bruhgimus);
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/Pinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
} }
} }
} }
@ -92,7 +91,7 @@ namespace SuperMachoBot
{ {
string thumbnailURL = GetRelevantEmbedURL(message); string thumbnailURL = GetRelevantEmbedURL(message);
string desc = ""; string desc = "";
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/UltraPinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
if (message.Content != "") if (message.Content != "")
{ {
desc = $@"""{message.Content}"""; desc = $@"""{message.Content}""";
@ -108,7 +107,6 @@ namespace SuperMachoBot
Color = new DiscordColor("#66ff33") Color = new DiscordColor("#66ff33")
}.AddField("Gemerald:", $"[link]({message.JumpLink})").Build(); }.AddField("Gemerald:", $"[link]({message.JumpLink})").Build();
await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, bruhgimus); await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, bruhgimus);
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/UltraPinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
} }
} }
} }
@ -125,6 +123,8 @@ namespace SuperMachoBot
string thumbnailURL = GetRelevantEmbedURL(message); string thumbnailURL = GetRelevantEmbedURL(message);
string desc = ""; string desc = "";
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/Pinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
if (message.Content != "") if (message.Content != "")
{ {
desc = $@"""{message.Content}"""; desc = $@"""{message.Content}""";
@ -140,7 +140,6 @@ namespace SuperMachoBot
Color = DiscordColor.Black Color = DiscordColor.Black
}.AddField("Coal:", $"[link]({message.JumpLink})").Build(); }.AddField("Coal:", $"[link]({message.JumpLink})").Build();
await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, embed); await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, embed);
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/Pinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
} }
} }
} }
@ -157,6 +156,8 @@ namespace SuperMachoBot
string thumbnailURL = GetRelevantEmbedURL(message); string thumbnailURL = GetRelevantEmbedURL(message);
string desc = ""; string desc = "";
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/UltraPinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
if (message.Content != "") if (message.Content != "")
{ {
desc = $@"""{message.Content}"""; desc = $@"""{message.Content}""";
@ -172,7 +173,6 @@ namespace SuperMachoBot
Color = DiscordColor.DarkRed Color = DiscordColor.DarkRed
}.AddField("Brimstone:", $"[link]({message.JumpLink})").Build(); }.AddField("Brimstone:", $"[link]({message.JumpLink})").Build();
await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, embed); await discord.SendMessageAsync(discord.GetChannelAsync(config[0].gemboardChannelId).Result, embed);
File.AppendAllText($"{databasePath}/{message.Channel.GuildId}/UltraPinned.txt", message.Id.ToString() + $",{message.Author.Id}\n");
} }
} }
} }