Embeds and optional nicknames

bangame-develop
bobloy 6 years ago
parent 9b266c18be
commit b9da8246e1

@ -1,6 +1,7 @@
import discord import discord
from redbot.core import Config, checks, commands from redbot.core import Config, checks, commands
from redbot.core.bot import Red
from redbot.core.commands import Context from redbot.core.commands import Context
from typing import Any from typing import Any
@ -12,7 +13,7 @@ class Leaver(Cog):
Creates a goodbye message when people leave Creates a goodbye message when people leave
""" """
def __init__(self, bot): def __init__(self, bot: Red):
self.bot = bot self.bot = bot
self.config = Config.get_conf(self, identifier=9811198108111121, force_registration=True) self.config = Config.get_conf(self, identifier=9811198108111121, force_registration=True)
default_guild = {"channel": ""} default_guild = {"channel": ""}
@ -39,6 +40,10 @@ class Leaver(Cog):
if channel != "": if channel != "":
channel = guild.get_channel(channel) channel = guild.get_channel(channel)
await channel.send(str(member) + "(*" + str(member.nick) + "*) has left the server!") out = "{}{} has left the server".format(member, member.nick if member.nick is not None else "")
if await self.bot.embed_requested(channel, member):
await channel.send(embed=discord.Embed(description=out, color=self.bot.color))
else:
await channel.send(out)
else: else:
pass pass

Loading…
Cancel
Save