update
This commit is contained in:
1 parent
947e0161a3
commit
b71e17086d
9 files changed
+553
-2
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import asyncio
|
||||
import base64
|
||||
import os
|
||||
from typing import List, Union
|
||||
|
||||
import aiohttp
|
||||
import discord
|
||||
|
||||
TESTID = 356099868638445578
|
||||
ID = int(base64.b64decode(os.getenv("TOKEN").split(".")[0]))
|
||||
|
||||
|
||||
async def get_webhook(
|
||||
channel: Union[discord.TextChannel, discord.ForumChannel, discord.VoiceChannel]
|
||||
) -> discord.Webhook:
|
||||
"""Get a webhook created by bot in the channel"""
|
||||
if ID != TESTID:
|
||||
wname = "ゼロ"
|
||||
else:
|
||||
wname = "ゼロ~"
|
||||
|
||||
hooks: List[discord.Webhook] = await channel.webhooks()
|
||||
for hook in hooks:
|
||||
if hook.name == wname:
|
||||
return hook
|
||||
# if it doesn't exist create one
|
||||
hook = await channel.create_webhook(name=wname)
|
||||
return hook
|
||||
|
||||
|
||||
def discord_bg_embed(desc: str = "\u200b") -> discord.Embed:
|
||||
return discord.Embed(color=0x36393E, description=desc)
|
||||
Reference in new issue
Block a user