(guild admin): Autoroles and role persistence.

This commit is contained in:
2021-10-05 00:28:33 +03:00
parent 4a34814a3b
commit 8b6f60d7f3
8 changed files with 273 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
import discord
from cmdClient.Context import Context
from meta import client
from .settings import greeting_message, greeting_channel, returning_message
@client.add_after_event('member_join')
async def send_greetings(client, member):
guild = member.guild
returning = bool(client.data.lions.fetch((guild.id, member.id)))
# Handle greeting message
channel = greeting_channel.get(guild.id).value
if channel is not None:
if channel == greeting_channel.DMCHANNEL:
channel = member
ctx = Context(client, guild=guild, author=member)
if returning:
args = returning_message.get(guild.id).args(ctx)
else:
args = greeting_message.get(guild.id).args(ctx)
try:
await channel.send(**args)
except discord.HTTPException:
pass