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 1
1
import discord
2
- from discord import app_commands
3
2
from discord .ext import commands
3
+ from typing import Optional
4
4
5
5
from src .utils import Embeds , Error
6
6
from src .config import Config
@@ -12,6 +12,9 @@ class Invite(commands.Cog):
12
12
Handles welcoming new members
13
13
"""
14
14
15
+ client : commands .Bot
16
+
17
+
15
18
def __init__ (self , client : commands .Bot ) -> None :
16
19
self .client = client
17
20
@@ -24,9 +27,9 @@ async def on_ready(self):
24
27
@commands .Cog .listener ()
25
28
async def on_member_join (self , member : discord .Member ):
26
29
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 )
28
31
29
- if welcome_channel :
32
+ if welcome_channel and isinstance ( welcome_channel , discord . TextChannel ) :
30
33
await welcome_channel .send (member .mention , embed = Embeds (
31
34
title = member .global_name ,
32
35
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