Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Tabby
00f64e9fe4 meow 2026-01-03 18:06:32 +11:00
Tabby
3ec2b90e8e started building a scam message checker 2025-12-04 02:09:49 +11:00
7 changed files with 90 additions and 5 deletions

View file

@ -1,6 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://cd60nfxe4lnq1"] [gd_scene load_steps=4 format=3 uid="uid://cd60nfxe4lnq1"]
[ext_resource type="Script" uid="uid://cus8nh0g3yyj2" path="res://main.gd" id="1_glv2v"] [ext_resource type="Script" uid="uid://cus8nh0g3yyj2" path="res://main.gd" id="1_glv2v"]
[ext_resource type="PackedScene" uid="uid://i3rqbgerpgey" path="res://checker/Checker.tscn" id="2_r0du0"]
[ext_resource type="Script" uid="uid://8yiff3da5cxh" path="res://checker/checker.gd" id="3_cm0pq"]
[node name="Main" type="Control"] [node name="Main" type="Control"]
layout_mode = 3 layout_mode = 3
@ -10,3 +12,8 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_glv2v") script = ExtResource("1_glv2v")
[node name="Checker" parent="." instance=ExtResource("2_r0du0")]
script = ExtResource("3_cm0pq")
[connection signal="message_created" from="." to="Checker" method="_on_main_message_created"]

11
TODO.md
View file

@ -27,5 +27,16 @@
- [x] spool list - [x] spool list
- [x] spool delete search result (removed embed) - [x] spool delete search result (removed embed)
## scam message checker
- [ ] 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 ### Possible furture development
- job management - job management

View file

@ -272,6 +272,13 @@ func unban_member(guild_id: String, user_id: String):
var res = await _send_request('/guilds/%s/bans/%s' % [guild_id, user_id], {}, HTTPClient.METHOD_DELETE) var res = await _send_request('/guilds/%s/bans/%s' % [guild_id, user_id], {}, HTTPClient.METHOD_DELETE)
return res return res
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): func permissions_for(user_id: String, channel_id: String):
# Permissions for a user in a channel # Permissions for a user in a channel

3
checker/Checker.tscn Normal file
View file

@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://i3rqbgerpgey"]
[node name="Checker" type="Node"]

52
checker/checker.gd Normal file
View file

@ -0,0 +1,52 @@
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.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
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
# server join date = message.member["joined_at"]
# 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.

1
checker/checker.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://8yiff3da5cxh

12
main.gd
View file

@ -6,6 +6,7 @@ signal interaction_create(world, bot, interaction, data)
var interactions = {} var interactions = {}
var application_commands = {} var application_commands = {}
signal message_created(bot: DiscordBot, message: Message, channel: Dictionary)
func _load_bot_token() -> String: func _load_bot_token() -> String:
# read from .env file DISORD_BOT_TOKEN # read from .env file DISORD_BOT_TOKEN
@ -30,7 +31,7 @@ func _ready() -> void:
bot.TOKEN = token bot.TOKEN = token
#bot.INTENTS = 4609 #bot.INTENTS = 4609
bot.bot_ready.connect(_on_bot_ready) bot.bot_ready.connect(_on_bot_ready)
#bot.message_create.connect(_on_message_create) bot.message_create.connect(_on_message_create)
bot.interaction_create.connect(_on_interaction_create) bot.interaction_create.connect(_on_interaction_create)
bot.INTENTS = bot.INTENTS | (1 << 12) bot.INTENTS = bot.INTENTS | (1 << 12)
bot.login() bot.login()
@ -56,14 +57,17 @@ func _on_bot_ready(bot: DiscordBot):
# -----Single server (updates instantly) # -----Single server (updates instantly)
#_register_application_commands(bot, "guild_id_here") #_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 #_register_application_commands(bot, "1038007666032787476") # fabsoc
# -----Global (may take upto 1hr to update) # -----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: func _on_message_create(bot: DiscordBot, message: Message, channel: Dictionary) -> void:
#print("meow!")
message_created.emit(bot, message, channel)
#if message.author.bot or not message.content.begins_with(prefix): #if message.author.bot or not message.content.begins_with(prefix):
#return #return
# #