Compare commits
No commits in common. "a49ab9f542d8ff56fe059db71e6bddad481173fe" and "39b32de588057efc7b857a5850e5af28a87dcfe6" have entirely different histories.
a49ab9f542
...
39b32de588
7
bot.py
7
bot.py
@ -1,7 +1,6 @@
|
|||||||
from asyncio import new_event_loop
|
from asyncio import new_event_loop
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from os import environ
|
from os import environ
|
||||||
from typing import Optional, Union
|
|
||||||
|
|
||||||
from disnake import Client, Guild, Member
|
from disnake import Client, Guild, Member
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
@ -31,21 +30,21 @@ client = Discord()
|
|||||||
app = Quart(__name__)
|
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:
|
for guild in client.guilds:
|
||||||
if guild.id == int(guild_id) or guild.vanity_url_code == str(guild_id):
|
if guild.id == int(guild_id) or guild.vanity_url_code == str(guild_id):
|
||||||
return guild
|
return guild
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_bot_member(guild: Guild) -> Optional[Member]:
|
def get_bot_member(guild: Guild) -> Member | None:
|
||||||
for member in guild.members:
|
for member in guild.members:
|
||||||
if member.id == client.user.id:
|
if member.id == client.user.id:
|
||||||
return member
|
return member
|
||||||
return None
|
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_permissions.manage_guild:
|
||||||
if member.guild.vanity_url_code:
|
if member.guild.vanity_url_code:
|
||||||
return member.guild.vanity_url_code
|
return member.guild.vanity_url_code
|
||||||
|
Loading…
Reference in New Issue
Block a user