- Adds Jellyfin external URL config option - URL to send to users if different from server URL. - Adds Jellyfin server setup timeout after 5 seconds, and response delaying so discord bot doesn't timeout task: gh-13
28 lines
1.4 KiB
Python
28 lines
1.4 KiB
Python
import discord
|
|
|
|
# these were copied from the app object. They could be made static instead but I'm lazy.
|
|
async def embederror(recipient, message, ephemeral=True):
|
|
embed = discord.Embed(title="ERROR",description=message, color=0xf50000)
|
|
await send_embed(recipient, embed, ephemeral)
|
|
|
|
async def embedinfo(recipient, message, ephemeral=True):
|
|
embed = discord.Embed(title=message, color=0x00F500)
|
|
await send_embed(recipient, embed, ephemeral)
|
|
|
|
async def embedcustom(recipient, title, fields, ephemeral=True):
|
|
embed = discord.Embed(title=title)
|
|
for k in fields:
|
|
embed.add_field(name=str(k), value=str(fields[k]), inline=True)
|
|
await send_embed(recipient, embed, ephemeral)
|
|
|
|
async def send_info(recipient, message, ephemeral=True):
|
|
if isinstance(recipient, discord.InteractionResponse):
|
|
await recipient.send_message(message, ephemeral=ephemeral)
|
|
elif isinstance(recipient, discord.User) or isinstance(recipient, discord.member.Member) or isinstance(recipient, discord.Webhook):
|
|
await recipient.send(message)
|
|
|
|
async def send_embed(recipient, embed, ephemeral=True):
|
|
if isinstance(recipient, discord.User) or isinstance(recipient, discord.member.Member) or isinstance(recipient, discord.Webhook):
|
|
await recipient.send(embed=embed)
|
|
elif isinstance(recipient, discord.InteractionResponse):
|
|
await recipient.send_message(embed=embed, ephemeral = ephemeral) |