import discord from typing import Optional from local_settings import OUTPUT_CHANNEL from query.guild import get_output_channel async def report(bot, message, guild: Optional[discord.Guild]=None): channel = bot.get_channel(OUTPUT_CHANNEL) if guild: message = f"**{guild}** | {message}" try: channel = bot.get_channel(get_output_channel(guild.id)) except: pass await channel.send(message)