Compare commits

..

No commits in common. "a49ab9f542d8ff56fe059db71e6bddad481173fe" and "39b32de588057efc7b857a5850e5af28a87dcfe6" have entirely different histories.

7
bot.py
View File

@ -1,7 +1,6 @@
from asyncio import new_event_loop
from datetime import timedelta
from os import environ
from typing import Optional, Union
from disnake import Client, Guild, Member
from dotenv import load_dotenv
@ -31,21 +30,21 @@ client = Discord()
app = Quart(__name__)
def get_guild_by_id(guild_id: Union[int, str]) -> Optional[Guild]:
def get_guild_by_id(guild_id: int | str) -> Guild | None:
for guild in client.guilds:
if guild.id == int(guild_id) or guild.vanity_url_code == str(guild_id):
return guild
return None
def get_bot_member(guild: Guild) -> Optional[Member]:
def get_bot_member(guild: Guild) -> Member | None:
for member in guild.members:
if member.id == client.user.id:
return member
return None
async def get_guild_tag(member: Member) -> Optional[str]:
async def get_guild_tag(member: Member) -> str | None:
if member.guild_permissions.manage_guild:
if member.guild.vanity_url_code:
return member.guild.vanity_url_code