File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 11import discord
2- from discord import app_commands
32from discord .ext import commands
3+ from typing import Optional
44
55from src .utils import Embeds , Error
66from src .config import Config
@@ -12,6 +12,9 @@ class Invite(commands.Cog):
1212 Handles welcoming new members
1313 """
1414
15+ client : commands .Bot
16+
17+
1518 def __init__ (self , client : commands .Bot ) -> None :
1619 self .client = client
1720
@@ -24,9 +27,9 @@ async def on_ready(self):
2427 @commands .Cog .listener ()
2528 async def on_member_join (self , member : discord .Member ):
2629 guild = self .client .get_guild (Config .GUILD_ID )
27- welcome_channel = guild .get_channel (Config .WELCOME_CHANNEL_ID )
30+ welcome_channel = guild and guild .get_channel (Config .WELCOME_CHANNEL_ID )
2831
29- if welcome_channel :
32+ if welcome_channel and isinstance ( welcome_channel , discord . TextChannel ) :
3033 await welcome_channel .send (member .mention , embed = Embeds (
3134 title = member .global_name ,
3235 description = f'**Welcome to the server!** 🎉\n \n Don\' t forget to `git checkout `<#{ Config .RULE_CHANNEL_ID } >'
You can’t perform that action at this time.
0 commit comments