Skip to content

Commit 36303ea

Browse files
Refactor invite manager
1 parent 0ded28e commit 36303ea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/cogs/invite_manager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import discord
2-
from discord import app_commands
32
from discord.ext import commands
3+
from typing import Optional
44

55
from src.utils import Embeds, Error
66
from 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\nDon\'t forget to `git checkout `<#{Config.RULE_CHANNEL_ID}>'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy