26 lines
673 B
Python
26 lines
673 B
Python
import asyncio
|
|
import base64
|
|
import os
|
|
from typing import List, Union
|
|
|
|
import aiohttp
|
|
import discord
|
|
|
|
|
|
async def get_webhook(
|
|
channel: Union[discord.TextChannel, discord.ForumChannel, discord.VoiceChannel]
|
|
) -> discord.Webhook:
|
|
"""Get a webhook created by bot in the channel"""
|
|
wname = "brahmos"
|
|
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)
|