Dough Git

commit

join role

commit
4811b87d3604a741e6ecb2a3ea5d02796466e84e
author
Clove Twilight <[email protected]>
date
2026-09-19 20:23

diff --git a/.env.example b/.env.example
index 147a696..a8b5c96 100644
--- a/.env.example
+++ b/.env.example
@@ -1,3 +1,5 @@
 BOT_TOKEN=
 GUILD_ID=
-DATABASE_DIR=./data
+JOIN_ROLE_ID=
+BOT_JOIN_ROLE_ID=
+DATABASE_DIR=./data
\ No newline at end of file
diff --git a/columbina/client.py b/columbina/client.py
index 7fa3894..7b365c3 100644
--- a/columbina/client.py
+++ b/columbina/client.py
@@ -421,7 +421,6 @@ async def runBot() -> None:
 
         print(cf.grey("[shutdown] bot closed"))
 
-
 def main() -> None:
     if config.TOKEN is None:
         raise SystemExit("The Bot Token is not set, please configure .env")
diff --git a/columbina/config.py b/columbina/config.py
index 1d1de54..d6993b5 100644
--- a/columbina/config.py
+++ b/columbina/config.py
@@ -38,7 +38,8 @@ def readId(raw: str | None) -> int | None:
 # — a global sync can take up to an hour to appear. Left unset, she falls back
 # to the only server she's in.
 guildId = readId(os.getenv("GUILD_ID"))
-
+joinRoleID = readId(os.getenv("JOIN_ROLE_ID"))
+botRoleID = readId(os.getenv("BOT_JOIN_ROLE_ID"))
 
 def resolveDir(raw: str | None, fallback: Path) -> Path:
     """A configured directory, read relative to the repo rather than the cwd.
diff --git a/utils/events.py b/utils/events.py
new file mode 100644
index 0000000..51df7ad
--- /dev/null
+++ b/utils/events.py
@@ -0,0 +1,20 @@
+import discord
+from columbina import client, config
+
[email protected]
+async def on_member_join(member: discord.Member) -> None:
+    role = member.guild.get_role(config.joinRoleID)
+    botRole = member.guild.get_role(config.botRoleID)
+
+    if member.bot:
+        if botRole is None:
+            print(f"[join] Could not find join role {config.botRoleID}")
+            return
+
+        await member.add_roles(botRole)
+
+    if role is None:
+        print(f"[join] Could not find join role {config.joinRoleID}")
+        return
+
+    await member.add_roles(role)
\ No newline at end of file