From 175eec55b2b94b903e36418f1b07a37aeb8088cb Mon Sep 17 00:00:00 2001 From: Erisa A Date: Wed, 19 Jun 2024 03:42:06 +0100 Subject: [PATCH 01/11] Update scams.txt --- Lists/scams.txt | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Lists/scams.txt b/Lists/scams.txt index 26a402e6..417d0c18 100644 --- a/Lists/scams.txt +++ b/Lists/scams.txt @@ -322,18 +322,7 @@ everyday from our trading signals FRЕЕ GIFТ DISСОRD NIТRO - k4vzy FRЕЕ GIFТ DISСОRD NIТRO -7eofb -FRЕЕ -GIFТ -DISСОRD -NIТRO -2h7b7c3z -FRЕЕ -GIFТ -DISСОRD -NIТRO 5dcue363 -BRO best cheats - https best_cheatse Bro did you see this? @@ -349,16 +338,6 @@ of charge - without registration and SMS FRЕЕ GIFТ DISСОRD NIТRO - If $5000 is deposited in your cash it’s real and legitimate drop your cash app tag -𝐅𝐎𝐑 𝐀𝐍𝐘 𝐊𝐈𝐍𝐃 𝐎𝐅 𝐒𝐄𝐑𝐕𝐈𝐂𝐄 -𝐍𝐎 𝐒𝐂𝐀𝐌 -𝗙𝗮𝗰𝗲𝗯𝗼𝗼𝗸 𝗛𝗮𝗰𝗸 -𝗪𝗵𝗮𝘁𝘀𝗔𝗽𝗽 𝗛𝗮𝗰𝗸 -𝗜𝗻𝘀𝘁𝗮𝗴𝗿𝗮𝗺 𝗛𝗮𝗰𝗸 -𝗥𝗲𝗰𝗼𝘃𝗲𝗿 𝗣𝗮𝘀𝘀𝘄𝗼𝗿𝗱 -𝗚𝗺𝗮𝗶𝗹 𝗛𝗮𝗰𝗸 -𝗦𝗻𝗮𝗽 𝗖𝗵𝗮𝘁 𝗛𝗮𝗰𝗸 -𝗧𝗶𝗸 𝗧𝗼𝗸 𝗛𝗮𝗰𝗸 -𝗧𝘄𝗲𝗲𝘁𝗲𝗿 𝗛𝗮𝗰𝗸 COIN BASE/CRYPTOCURRENCY RECOVERY ROBLOX HACK/RECOVER !!! Enjoy the most profitable financial market (crypto From 236cd3c7c6ab8b1b3b0b58f340cf64ee86f413db Mon Sep 17 00:00:00 2001 From: Erisa A Date: Wed, 19 Jun 2024 03:48:05 +0100 Subject: [PATCH 02/11] Update scams.txt --- Lists/scams.txt | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Lists/scams.txt b/Lists/scams.txt index 417d0c18..694ad02e 100644 --- a/Lists/scams.txt +++ b/Lists/scams.txt @@ -54,11 +54,8 @@ discord nitro for free in steam store /airdrop-nitro i am going to the army, so you can take all ), hurry up, not enough for everyone -dliscrd new airdop from discord and steam -take your turn here: less than a month left !!! -nitroforyou gays, i'm leaving f*cking cs:go to cod do not forget to write me +rep in the profile after trade @@ -100,7 +97,6 @@ who will have time to pick up first - http discord is sharing 3 months of discord nitro with steam hurry up to get your gift right now, you will receive a gift and i will upgrade my server, thanks for your attention -take nitro http steam-nitro steam give nitro / steam give nitro discоrd nitrо fоr frее - stеаm @@ -116,7 +112,6 @@ get discord nitro for free personally from discord offer ends september 29, 2021 at 11am edt /gift/bgjytubxnshef2rz /hazla/free -free steam give nitro Видели? Там нитро опять раздают на 3 месяца discord started the new season of hypesquad events @@ -157,7 +152,6 @@ airdrop discord free nitro from steam offer is valid until 18:00 on october 31, 2021. personalize your profile, share your screen in hd, update your emojis and more. • 3 months free on discord nitro get discord nitro for free in celebration of this event on the steam store -jahjajha free discord nitro for 3 month!! airdrop discord nitro with steam hello bro is my gift for you with nitro boost @@ -232,11 +226,9 @@ RU Новогодний подарок от gifts for the new year, nitro for hey, gift nitro for 3 months here discode.gift -who is first? :) who will catch this gift?) 3 month nitro for free, take it hi steam gifts nitro -whо is first? :) кто успеет) deals anything on microsoft store hi steam gived nitro @@ -302,7 +294,6 @@ send me a friend request and a DM saying "HOW" david_shaw01 408‑2566 FloraGordon -FRЕЕ GIFТ DISСОRD NIТRO would you like to discover how to profit from the cryptocurrency market if YES I’m willing to help 11 people how to earn $100,000 in @@ -319,13 +310,11 @@ you get up to $3,000 profits everyday everyday from our trading signals ❤️Look what I found for you - 34Jn7h -FRЕЕ GIFТ DISСОRD NIТRO - k4vzy FRЕЕ GIFТ DISСОRD NIТRO 5dcue363 best cheats - https best_cheatse -Bro did you see this? uCheatArchive AQ7m.gif TikTokNudessBot @@ -333,7 +322,6 @@ anyone interested how to trade and earn 50k 50k in just 72hrs from drop a direct message (HOW) On our site you can find the best programs for free -Download free software completely free of charge - without registration and SMS FRЕЕ GIFТ DISСОRD NIТRO - If $5000 is deposited in your cash @@ -342,7 +330,6 @@ COIN BASE/CRYPTOCURRENCY RECOVERY ROBLOX HACK/RECOVER !!! Enjoy the most profitable financial market (crypto market ) as you get 100% profit... -and you can also make up to $ $110,000 or more in days send me a private message and ask me how AIRDROP CS:GO @@ -375,7 +362,6 @@ without no doubts from the crypto market. But you will have to pay me my commiss hello! the beginning of a global cs:go tournament tournament with a prize pool of $100,000 i want to participate outside, but i don't have enough team, -you can participate somewhere with me "I'll help 20 people how to earn $30,000 72 hours of trading from the crypto market BeatriceJonathan1 From 8a1d8f8d4f3431353eee27c0098091a95a624776 Mon Sep 17 00:00:00 2001 From: Milkshake Date: Wed, 19 Jun 2024 11:57:25 -0400 Subject: [PATCH 03/11] Add the ability to pause & unpause DMs (#196) * Add the ability to pause & unpause DMs * Apply suggestions from code review Co-authored-by: Erisa A * Fix broken syntax --------- Co-authored-by: Erisa A --- .../SecurityActionInteractions.cs | 100 +++++++++++++++ Commands/SecurityActions.cs | 117 ++++++++++++++++++ GlobalUsings.cs | 1 + Helpers/SecurityActionHelpers.cs | 25 ++++ 4 files changed, 243 insertions(+) create mode 100644 Commands/InteractionCommands/SecurityActionInteractions.cs create mode 100644 Commands/SecurityActions.cs create mode 100644 Helpers/SecurityActionHelpers.cs diff --git a/Commands/InteractionCommands/SecurityActionInteractions.cs b/Commands/InteractionCommands/SecurityActionInteractions.cs new file mode 100644 index 00000000..e9d60605 --- /dev/null +++ b/Commands/InteractionCommands/SecurityActionInteractions.cs @@ -0,0 +1,100 @@ +namespace Cliptok.Commands.InteractionCommands +{ + public class SecurityActionInteractions : ApplicationCommandModule + { + [SlashCommand("pausedms", "Temporarily pause DMs between server members.", defaultPermission: false)] + [HomeServer, SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.ModerateMembers)] + public async Task SlashPauseDMs(InteractionContext ctx, [Option("time", "The amount of time to pause DMs for. Cannot be greater than 24 hours.")] string time) + { + // need to make our own api calls because D#+ can't do this natively? + + // parse time from message + DateTime t = HumanDateParser.HumanDateParser.Parse(time); + if (t <= DateTime.Now) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time can't be in the past!"); + return; + } + if (t > DateTime.Now.AddHours(24)) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time can't be greater than 24 hours!"); + return; + } + var dmsDisabledUntil = t.ToUniversalTime().ToString("o"); + + // get current security actions to avoid unintentionally resetting invites_disabled_until + var currentActions = await SecurityActionHelpers.GetCurrentSecurityActions(ctx.Guild.Id); + JToken invitesDisabledUntil; + if (currentActions is null || !currentActions.HasValues) + invitesDisabledUntil = null; + else + invitesDisabledUntil = currentActions["invites_disabled_until"]; + + // create json body + var newSecurityActions = JsonConvert.SerializeObject(new + { + invites_disabled_until = invitesDisabledUntil, + dms_disabled_until = dmsDisabledUntil, + }); + + // set actions + var setActionsResponse = await SecurityActionHelpers.SetCurrentSecurityActions(ctx.Guild.Id, newSecurityActions); + + // respond + if (setActionsResponse.IsSuccessStatusCode) + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Successfully paused DMs until !"); + else + { + ctx.Client.Logger.LogError("Failed to set Security Actions.\nPayload: {payload}\nResponse: {statuscode} {body}", newSecurityActions.ToString(), (int)setActionsResponse.StatusCode, await setActionsResponse.Content.ReadAsStringAsync()); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Something went wrong and I wasn't able to unpause DMs! Discord returned status code `{setActionsResponse.StatusCode}`."); + } + } + + [SlashCommand("unpausedms", "Unpause DMs between server members.", defaultPermission: false)] + [HomeServer, SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.ModerateMembers)] + public async Task SlashUnpauseDMs(InteractionContext ctx) + { + // need to make our own api calls because D#+ can't do this natively? + + // get current security actions to avoid unintentionally resetting invites_disabled_until + var currentActions = await SecurityActionHelpers.GetCurrentSecurityActions(ctx.Guild.Id); + JToken dmsDisabledUntil, invitesDisabledUntil; + if (currentActions is null || !currentActions.HasValues) + { + dmsDisabledUntil = null; + invitesDisabledUntil = null; + } + else + { + dmsDisabledUntil = currentActions["dms_disabled_until"]; + invitesDisabledUntil = currentActions["invites_disabled_until"]; + } + + // if dms are already unpaused, return error + if (dmsDisabledUntil is null) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} DMs are already unpaused!"); + return; + } + + // create json body + var newSecurityActions = JsonConvert.SerializeObject(new + { + invites_disabled_until = invitesDisabledUntil, + dms_disabled_until = (object)null, + }); + + // set actions + var setActionsResponse = await SecurityActionHelpers.SetCurrentSecurityActions(ctx.Guild.Id, newSecurityActions); + + // respond + if (setActionsResponse.IsSuccessStatusCode) + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Successfully unpaused DMs!"); + else + { + ctx.Client.Logger.LogError("Failed to set Security Actions.\nPayload: {payload}\nResponse: {statuscode} {body}", newSecurityActions.ToString(), (int)setActionsResponse.StatusCode, await setActionsResponse.Content.ReadAsStringAsync()); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Something went wrong and I wasn't able to pause DMs! Discord returned status code `{setActionsResponse.StatusCode}`."); + } + } + } +} \ No newline at end of file diff --git a/Commands/SecurityActions.cs b/Commands/SecurityActions.cs new file mode 100644 index 00000000..98cdf9ef --- /dev/null +++ b/Commands/SecurityActions.cs @@ -0,0 +1,117 @@ +namespace Cliptok.Commands +{ + public class SecurityActions : BaseCommandModule + { + [Command("pausedms")] + [Description("Temporarily pause DMs between server members.")] + [HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator)] + public async Task PauseDMs(CommandContext ctx, [Description("The amount of time to pause DMs for."), RemainingText] string time) + { + if (string.IsNullOrWhiteSpace(time)) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} You must provide an amount of time to pause DMs for!"); + return; + } + + // need to make our own api calls because D#+ can't do this natively? + + // parse time from message + DateTime t; + try + { + t = HumanDateParser.HumanDateParser.Parse(time); + } + catch (HumanDateParser.ParseException) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I didn't understand that time! Please try again."); + return; + } + if (t <= DateTime.Now) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time can't be in the past!"); + return; + } + if (t > DateTime.Now.AddHours(24)) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Time can't be greater than 24 hours!"); + return; + } + var dmsDisabledUntil = t.ToUniversalTime().ToString("o"); + + // get current security actions to avoid unintentionally resetting invites_disabled_until + var currentActions = await SecurityActionHelpers.GetCurrentSecurityActions(ctx.Guild.Id); + JToken invitesDisabledUntil; + if (currentActions is null || !currentActions.HasValues) + invitesDisabledUntil = null; + else + invitesDisabledUntil = currentActions["invites_disabled_until"]; + + // create json body + var newSecurityActions = JsonConvert.SerializeObject(new + { + invites_disabled_until = invitesDisabledUntil, + dms_disabled_until = dmsDisabledUntil, + }); + + // set actions + var setActionsResponse = await SecurityActionHelpers.SetCurrentSecurityActions(ctx.Guild.Id, newSecurityActions); + + // respond + if (setActionsResponse.IsSuccessStatusCode) + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Successfully paused DMs for **{TimeHelpers.TimeToPrettyFormat(t.Subtract(ctx.Message.Timestamp.DateTime), false)}**!"); + else + { + ctx.Client.Logger.LogError("Failed to set Security Actions.\nPayload: {payload}\nResponse: {statuscode} {body}", newSecurityActions.ToString(), (int)setActionsResponse.StatusCode, await setActionsResponse.Content.ReadAsStringAsync()); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Something went wrong and I wasn't able to pause DMs! Discord returned status code `{setActionsResponse.StatusCode}`."); + } + } + + [Command("unpausedms")] + [Description("Unpause DMs between server members.")] + [HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator)] + public async Task UnpauseDMs(CommandContext ctx) + { + // need to make our own api calls because D#+ can't do this natively? + + // get current security actions to avoid unintentionally resetting invites_disabled_until + var currentActions = await SecurityActionHelpers.GetCurrentSecurityActions(ctx.Guild.Id); + JToken dmsDisabledUntil, invitesDisabledUntil; + if (currentActions is null || !currentActions.HasValues) + { + dmsDisabledUntil = null; + invitesDisabledUntil = null; + } + else + { + dmsDisabledUntil = currentActions["dms_disabled_until"]; + invitesDisabledUntil = currentActions["invites_disabled_until"]; + } + + // if dms are already unpaused, return error + if (dmsDisabledUntil is null) + { + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} DMs are already unpaused!"); + return; + } + + // create json body + var newSecurityActions = JsonConvert.SerializeObject(new + { + invites_disabled_until = invitesDisabledUntil, + dms_disabled_until = (object)null, + }); + + // set actions + var setActionsResponse = await SecurityActionHelpers.SetCurrentSecurityActions(ctx.Guild.Id, newSecurityActions); + + // respond + if (setActionsResponse.IsSuccessStatusCode) + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Successfully unpaused DMs!"); + else + { + ctx.Client.Logger.LogError("Failed to set Security Actions.\nPayload: {payload}\nResponse: {statuscode} {body}", newSecurityActions.ToString(), (int)setActionsResponse.StatusCode, await setActionsResponse.Content.ReadAsStringAsync()); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} Something went wrong and I wasn't able to unpause DMs! Discord returned status code `{setActionsResponse.StatusCode}`."); + } + } + } +} \ No newline at end of file diff --git a/GlobalUsings.cs b/GlobalUsings.cs index 6d870565..d8a9ff6c 100644 --- a/GlobalUsings.cs +++ b/GlobalUsings.cs @@ -10,6 +10,7 @@ global using DSharpPlus.SlashCommands; global using Microsoft.Extensions.Logging; global using Newtonsoft.Json; +global using Newtonsoft.Json.Linq; global using Serilog; global using Serilog.Sinks.SystemConsole.Themes; global using StackExchange.Redis; diff --git a/Helpers/SecurityActionHelpers.cs b/Helpers/SecurityActionHelpers.cs new file mode 100644 index 00000000..7734e379 --- /dev/null +++ b/Helpers/SecurityActionHelpers.cs @@ -0,0 +1,25 @@ +namespace Cliptok.Helpers +{ + public class SecurityActionHelpers + { + public static async Task GetCurrentSecurityActions(ulong guildId) + { + using HttpRequestMessage getActionsRequest = new(HttpMethod.Get, $"https://discord.com/api/v{Program.discord.GatewayVersion}/guilds/{guildId}"); + getActionsRequest.Headers.Authorization = new AuthenticationHeaderValue("Bot", Environment.GetEnvironmentVariable("CLIPTOK_TOKEN") ?? Program.cfgjson.Core.Token); + + var getActionsResponse = await Program.httpClient.SendAsync(getActionsRequest); + return ((JObject)JsonConvert.DeserializeObject(await getActionsResponse.Content.ReadAsStringAsync()))["incidents_data"]; + } + + public static async Task SetCurrentSecurityActions(ulong guildId, string newSecurityActions) + { + // create & send request + + using HttpRequestMessage setActionsRequest = new(HttpMethod.Put, $"https://discord.com/api/v{Program.discord.GatewayVersion}/guilds/{guildId}/incident-actions"); + setActionsRequest.Headers.Authorization = new AuthenticationHeaderValue("Bot", Environment.GetEnvironmentVariable("CLIPTOK_TOKEN") ?? Program.cfgjson.Core.Token); + + setActionsRequest.Content = new StringContent(newSecurityActions, Encoding.UTF8, "application/json"); + return await Program.httpClient.SendAsync(setActionsRequest); + } + } +} \ No newline at end of file From 914de655af0ce954f2ab0fcd8addf94431b85d92 Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Thu, 20 Jun 2024 11:24:27 -0400 Subject: [PATCH 04/11] Use different !ask message in tech support channels --- Commands/TechSupport.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Commands/TechSupport.cs b/Commands/TechSupport.cs index 51fbef59..6a73ceb9 100644 --- a/Commands/TechSupport.cs +++ b/Commands/TechSupport.cs @@ -9,13 +9,20 @@ public async Task AskCmd(CommandContext ctx, [Description("Optional, a user to p { await ctx.Message.DeleteAsync(); DiscordEmbedBuilder embed = new DiscordEmbedBuilder() - .WithTitle("**__Need Help Or Have a Problem?__**") - .WithDescription( - $"You're probably looking for <#{Program.cfgjson.TechSupportChannel}> or <#{Program.cfgjson.SupportForumId}>!\n\n" + - $"Once there, please be sure to provide **plenty of details**, ping the <@&{Program.cfgjson.CommunityTechSupportRoleID}> role, and *be patient!*\n\n" + - $"Look under the `🔧 Support` category for the appropriate channel for your issue. See <#413274922413195275> for more info." - ) .WithColor(13920845); + if (ctx.Channel.Id == Program.cfgjson.TechSupportChannel || ctx.Channel.ParentId == Program.cfgjson.SupportForumId) + { + embed.Title = "**__Need help?__**"; + embed.Description = $"You are in the right place! Please state your question with *plenty of detail* and mention the <@&{Program.cfgjson.CommunityTechSupportRoleID}> role and someone may be able to help you.\n\n" + + $"Details includes error codes and other specific information."; + } + else + { + embed.Title = "**__Need Help Or Have a Problem?__**"; + embed.Description = $"You're probably looking for <#{Program.cfgjson.TechSupportChannel}> or <#{Program.cfgjson.SupportForumId}>!\n\n" + + $"Once there, please be sure to provide **plenty of details**, ping the <@&{Program.cfgjson.CommunityTechSupportRoleID}> role, and *be patient!*\n\n" + + $"Look under the `🔧 Support` category for the appropriate channel for your issue. See <#413274922413195275> for more info."; + } if (user != default) { From 01fd6be1d9eb56630895669351b40a5fbd3e1e3b Mon Sep 17 00:00:00 2001 From: Erisa A Date: Sat, 22 Jun 2024 22:25:25 +0100 Subject: [PATCH 05/11] Parse broken options for warn-related slash commands --- .../InteractionCommands/WarningInteractions.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Commands/InteractionCommands/WarningInteractions.cs b/Commands/InteractionCommands/WarningInteractions.cs index 50d33f15..3fff6c01 100644 --- a/Commands/InteractionCommands/WarningInteractions.cs +++ b/Commands/InteractionCommands/WarningInteractions.cs @@ -169,8 +169,12 @@ public async Task WarndetailsSlashCommand(InteractionContext ctx, [Option("public", "Whether to show the output publicly.")] bool publicWarnings = false ) { - long warnId = default; + if (warning.Contains(' ')) + { + warning = warning.Split(' ')[0]; + } + long warnId; try { warnId = Convert.ToInt64(warning); @@ -197,8 +201,12 @@ public async Task DelwarnSlashCommand(InteractionContext ctx, [Option("public", "Whether to show the output publicly. Default: false")] bool showPublic = false ) { - long warnId = default; + if (warningId.Contains(' ')) + { + warningId = warningId.Split(' ')[0]; + } + long warnId; try { warnId = Convert.ToInt64(warningId); @@ -246,8 +254,12 @@ public async Task EditWarnSlashCommand(InteractionContext ctx, [Option("new_reason", "The new reason for the warning")] string reason, [Option("public", "Whether to show the output publicly. Default: false")] bool showPublic = false) { - long warnId = default; + if (warning.Contains(' ')) + { + warning = warning.Split(' ')[0]; + } + long warnId; try { warnId = Convert.ToInt64(warning); From 492e3bb94cf74e08b2917f9374a57d09d3801e0e Mon Sep 17 00:00:00 2001 From: Erisa A Date: Sat, 22 Jun 2024 22:40:26 +0100 Subject: [PATCH 06/11] Pull the log level from config.json --- Program.cs | 34 ++++++++++++++++++++++++++-------- Structs.cs | 11 ++++++++--- config.json | 3 ++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Program.cs b/Program.cs index ccbe1c65..cfd01e39 100644 --- a/Program.cs +++ b/Program.cs @@ -52,17 +52,11 @@ static async Task Main(string[] _) httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var logFormat = "[{Timestamp:yyyy-MM-dd HH:mm:ss zzz}] [{Level}] {Message}{NewLine}{Exception}"; - Log.Logger = new LoggerConfiguration() -#if DEBUG - .MinimumLevel.Debug() -#else - .MinimumLevel.Information() -#endif + var loggerConfig = new LoggerConfiguration() .WriteTo.Console(outputTemplate: logFormat, theme: AnsiConsoleTheme.Literate) .WriteTo.TextWriter(outputCapture, outputTemplate: logFormat) .WriteTo.DiscordSink(restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information, outputTemplate: logFormat) - .Filter.ByExcluding(log => { return log.ToString().Contains("DSharpPlus.Exceptions.NotFoundException: Not found: NotFound"); }) - .CreateLogger(); + .Filter.ByExcluding(log => { return log.ToString().Contains("DSharpPlus.Exceptions.NotFoundException: Not found: NotFound"); }); var logFactory = new LoggerFactory().AddSerilog(); @@ -80,6 +74,30 @@ static async Task Main(string[] _) cfgjson = JsonConvert.DeserializeObject(json); + switch (cfgjson.LogLevel) + { + case Level.Information: + loggerConfig.MinimumLevel.Information(); + break; + case Level.Warning: + loggerConfig.MinimumLevel.Warning(); + break; + case Level.Error: + loggerConfig.MinimumLevel.Error(); + break; + case Level.Debug: + loggerConfig.MinimumLevel.Debug(); + break; + case Level.Verbose: + loggerConfig.MinimumLevel.Verbose(); + break; + default: + loggerConfig.MinimumLevel.Information(); + break; + } + + Log.Logger = loggerConfig.CreateLogger(); + hasteUploader = new HasteBinClient(cfgjson.HastebinEndpoint); UpdateLists(); diff --git a/Structs.cs b/Structs.cs index be74451d..8283ab5c 100644 --- a/Structs.cs +++ b/Structs.cs @@ -286,18 +286,23 @@ public class ConfigJson [JsonProperty("insiderCanaryThread")] public ulong InsiderCanaryThread { get; set; } = 0; - + [JsonProperty("tqsMutedRole")] public ulong TqsMutedRole { get; private set; } - + [JsonProperty("tqsMuteDurationHours")] public int TqsMuteDurationHours { get; private set; } - + [JsonProperty("autoWarnMsgAutoDeleteDays")] public int AutoWarnMsgAutoDeleteDays { get; private set; } + [JsonProperty("logLevel")] + public Level LogLevel { get; private set; } = Level.Information; + } + public enum Level { Information, Warning, Error, Debug, Verbose } + public class LogChannelConfig { [JsonProperty("channelId")] diff --git a/config.json b/config.json index 37bfb1fc..979958ec 100644 --- a/config.json +++ b/config.json @@ -323,5 +323,6 @@ "insiderCanaryThread": 1082394217168523315, "tqsMutedRole": 752821045408563230, "tqsMuteDurationHours": 2, - "autoWarnMsgAutoDeleteDays": 3 + "autoWarnMsgAutoDeleteDays": 3, + "logLevel": "Information" } From 2db2a5b7b65150730ddd1c4fb55541d327fca70b Mon Sep 17 00:00:00 2001 From: Erisa A Date: Sat, 22 Jun 2024 22:43:03 +0100 Subject: [PATCH 07/11] config: Enable debug logs in production --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 979958ec..404acab4 100644 --- a/config.json +++ b/config.json @@ -324,5 +324,5 @@ "tqsMutedRole": 752821045408563230, "tqsMuteDurationHours": 2, "autoWarnMsgAutoDeleteDays": 3, - "logLevel": "Information" + "logLevel": "Debug" } From 83a80bd06bd10166429b8379f336a8cf2b2d9d4d Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Sun, 23 Jun 2024 13:00:21 -0400 Subject: [PATCH 08/11] Fix up channel override persistence - Use cache to check if a member is in the guild vs making an async request for each member with an override - If a member is not in the guild and the target channel is a voice channel, remove their override --- Events/ChannelEvents.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Events/ChannelEvents.cs b/Events/ChannelEvents.cs index 48b7e874..3fb8f37d 100644 --- a/Events/ChannelEvents.cs +++ b/Events/ChannelEvents.cs @@ -35,19 +35,13 @@ public static async Task ChannelUpdated(DiscordClient _, ChannelUpdateEventArgs // Delay to allow leave to complete first await Task.Delay(500); - // Try to fetch member. If it fails, they are not in the guild. - try - { - await e.Guild.GetMemberAsync((ulong)userOverwrites.Name); - } - catch - { - // Failed to fetch user. They probably left or were otherwise removed from the server. - // Preserve overrides. - return; - } + // Try to fetch member. If it fails, they are not in the guild. If this is a voice channel, remove the override. + // (if they are not in the guild & this is not a voice channel, skip; otherwise, code below handles removal) + if (!e.Guild.Members.ContainsKey((ulong)userOverwrites.Name) && e.ChannelAfter.Type != ChannelType.Voice) + continue; // User could be fetched, so they are in the server and their override was removed. Remove from db. + // (or user could not be fetched & this is a voice channel; remove) var overrides = await Program.db.HashGetAsync("overrides", userOverwrites.Name); var dict = JsonConvert.DeserializeObject>(overrides); From 515d5a0caaa4081592b92558acc31f20af661fee Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Sun, 23 Jun 2024 13:41:52 -0400 Subject: [PATCH 09/11] Swap 'return' for 'continue' in autoban check --- Events/MemberEvents.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Events/MemberEvents.cs b/Events/MemberEvents.cs index 1d519fd0..50227448 100644 --- a/Events/MemberEvents.cs +++ b/Events/MemberEvents.cs @@ -81,7 +81,7 @@ public static async Task GuildMemberAdded(DiscordClient client, GuildMemberAddEv { if (db.HashExists(IdAutoBanSet.Name, e.Member.Id)) { - return; + continue; } if (e.Member.Id > IdAutoBanSet.LowerBound && e.Member.Id < IdAutoBanSet.UpperBound) From afe937267b7ff192808d6b11aab57eb6b8e8ab3c Mon Sep 17 00:00:00 2001 From: Milkshake Date: Sun, 23 Jun 2024 14:18:39 -0400 Subject: [PATCH 10/11] config: Disable debug logs in production --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 404acab4..979958ec 100644 --- a/config.json +++ b/config.json @@ -324,5 +324,5 @@ "tqsMutedRole": 752821045408563230, "tqsMuteDurationHours": 2, "autoWarnMsgAutoDeleteDays": 3, - "logLevel": "Debug" + "logLevel": "Information" } From 2f852a55bd56a0077c33d66bc940d3f2472b2401 Mon Sep 17 00:00:00 2001 From: GitHub Actions via Discord user erisachu <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 23 Jun 2024 22:05:48 +0000 Subject: [PATCH 11/11] erisachu: Update scams.txt --- Lists/scams.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lists/scams.txt b/Lists/scams.txt index 694ad02e..eab0fca7 100644 --- a/Lists/scams.txt +++ b/Lists/scams.txt @@ -478,3 +478,7 @@ We have collaborated with OPENSEA on a new free mint some claim might require gas! afagf2626/turbo-octo-sniffle download and check if it works or not, because I have some error +CosmoMinerRobot +6896250306 +I found a Telegram bot that actually pays money. I've already started farming and making some cas +one more friend to join so I can withdraw TON