diff --git a/TODO.md b/TODO.md index d56fb8c..9b1ee5d 100644 --- a/TODO.md +++ b/TODO.md @@ -31,7 +31,12 @@ - [ ] need to modify the command to allow for arguments for how long the timeout should last for - [ ] bunch of detecting if its a scam message or not - [ ] update server version - +- [ ] message counting +- [ ] immunity detection +- [ ] immunity give command +- [ ] move Pounce (this functionality) to its own independant bot + +- [ ] membership verification for fabsoc ### Possible furture development - job management diff --git a/addons/discord_gd/discord.gd b/addons/discord_gd/discord.gd index 59dd61f..9c67036 100644 --- a/addons/discord_gd/discord.gd +++ b/addons/discord_gd/discord.gd @@ -276,6 +276,9 @@ func timeout_member(guild_id: String, user_id: String, until : String): var res = await _send_request('/guilds/%s/members/%s' % [guild_id, user_id], {'communication_disabled_until' = '2025-12-5T09:49:58.965896+00:00'}, HTTPClient.METHOD_PATCH) return res +func delete_message(channel_id : String, message_id : String): + var res = await _send_request('/channels/%s/messages/%s' % [channel_id, message_id], {}, HTTPClient.METHOD_DELETE) + return res func permissions_for(user_id: String, channel_id: String): # Permissions for a user in a channel diff --git a/checker/checker.gd b/checker/checker.gd index 199ba53..116c7a5 100644 --- a/checker/checker.gd +++ b/checker/checker.gd @@ -1,6 +1,8 @@ extends Node +var reports_channel_id = "1433027391407788152" # channel to send admin report to + # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. @@ -12,6 +14,9 @@ func _process(delta: float) -> void: func _on_main_message_created(bot: DiscordBot, message: Message, channel: Dictionary) -> void: + if message.author.bot: + return + ## analyse every message to detect if it is a scam message or not # text = message.content # images = message.attachments - its an array, so count the attachments @@ -19,13 +24,29 @@ func _on_main_message_created(bot: DiscordBot, message: Message, channel: Dictio # could also keep track of how many messages the user has sent on the server and be more sensitive if its the first 5/10/20 or so # message.author.id , message.author.username # for any matches we find, we want to senda copy to the admin channel then delete the original copy and timeout the user + # add a check to make sure its not my own message + # Delete Message - /channels/{channel.id}/messages/{message.id} + # trust members after being around for 1 week + sending 20 messages? + #print(message) print(message.guild_id) if message.author.id == "616872480371376128": # its fuzzy, lets try and time them out + + print(message) + var attachment_string : String = "\n" + if message.attachments.size()>0: + for attach in message.attachments: + attachment_string += attach.url + ", " + bot.send(message, "Sorry <@" + message.author.id + "> your message was flagged as a suspected scam message, a mod will check it as soon as possible") + bot.send(reports_channel_id, { + "content" : "Message from <@" + message.author.id + "> detected as a scam message:\n" + message.content + attachment_string, + #"attachments" : message.attachments, + }) var until = "2025-12-05T00:00:00Z" bot.timeout_member(message.guild_id, message.author.id, until) + bot.delete_message(message.channel_id, message.id) pass # Replace with function body. diff --git a/main.gd b/main.gd index 6d6fb7c..953172f 100644 --- a/main.gd +++ b/main.gd @@ -57,11 +57,11 @@ func _on_bot_ready(bot: DiscordBot): # -----Single server (updates instantly) #_register_application_commands(bot, "guild_id_here") - #_register_application_commands(bot, "679917161195765822") # personal server + _register_application_commands(bot, "679917161195765822") # personal server #_register_application_commands(bot, "1038007666032787476") # fabsoc # -----Global (may take upto 1hr to update) - _register_application_commands(bot) # everywhere + #_register_application_commands(bot) # everywhere func _on_message_create(bot: DiscordBot, message: Message, channel: Dictionary) -> void: