Skip to content

Commit 4478795

Browse files
+ Invite manager
1 parent df2bff7 commit 4478795

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/cogs/invite_manager.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import discord
2+
from discord import app_commands
3+
from discord.ext import commands
4+
5+
from src.utils import Embeds, Error
6+
from src.config import Config
7+
8+
9+
class Invite(commands.Cog):
10+
"""hidden
11+
12+
Handles welcoming new members
13+
"""
14+
15+
def __init__(self, client: commands.Bot) -> None:
16+
self.client = client
17+
18+
19+
@commands.Cog.listener()
20+
async def on_ready(self):
21+
print('Invite Manager UP')
22+
23+
24+
@commands.Cog.listener()
25+
async def on_member_join(self, member: discord.Member):
26+
guild = self.client.get_guild(Config.GUILD_ID)
27+
welcome_channel = guild.get_channel(Config.WELCOME_CHANNEL_ID)
28+
29+
if welcome_channel:
30+
await welcome_channel.send(member.mention, embed = Embeds(
31+
title = member.global_name,
32+
description = f'**Welcome to the server!** 🎉\n\nDon\'t forget to `git checkout `<#{Config.RULE_CHANNEL_ID}>'
33+
))
34+
35+
36+
async def setup(client: commands.Bot):
37+
await client.add_cog(Invite(client))

0 commit comments

Comments
 (0)