def setwelcome(self, ctx, *, message = None):
"""Sets the welcome message for your server (bot-admin only). [[user]] = user name, [[atuser]] = user mention, [[server]] = server name"""
isAdmin = ctx.message.author.permissions_in(ctx.message.channel).administrator
if not isAdmin:
checkAdmin = self.settings.getServerStat(ctx.message.server, "AdminArray")
for role in ctx.message.author.roles:
for aRole in checkAdmin:
# Get the role that corresponds to the id
if aRole['ID'] == role.id:
isAdmin = True
# Only allow admins to change server stats
if not isAdmin:
await self.bot.send_message(ctx.message.channel, 'You do not have sufficient privileges to access this command.')
return
if message == None:
self.settings.setServerStat(ctx.message.server, "Welcome", None)
await self.bot.send_message(ctx.message.channel, 'Welcome message removed!')
return
self.settings.setServerStat(ctx.message.server, "Welcome", message)
await self.bot.send_message(ctx.message.channel, 'Welcome message updated!\n\nHere\'s a preview:')
await self._welcome(ctx.message.author, ctx.message.server, ctx.message.channel)
评论列表
文章目录