1
0
Fork 0

Merge pull request #12 from flifloo/greetings

Send greetings join message on guild system channel if user block pm
This commit is contained in:
Ethanell 2020-07-30 11:28:09 +02:00 committed by GitHub
commit b732349339
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
from discord.ext import commands
from discord import Member, Embed
from discord import Member, Embed, Forbidden
from discord.ext.commands import BadArgument
from administrator.logger import logger
@ -87,7 +87,11 @@ class Greetings(commands.Cog):
m = s.query(db.Greetings).filter(db.Greetings.guild == member.guild.id).first()
s.close()
if m and m.join_enable:
await member.send(embed=m.join_embed(member.guild.name, str(member)))
embed = m.join_embed(member.guild.name, str(member))
try:
await member.send(embed=embed)
except Forbidden:
await member.guild.system_channel.send(member.mention, embed=embed)
@commands.Cog.listener()
async def on_member_remove(self, member: Member):