def setchatchannel(self, ctx, *, channel : discord.Channel = None):
"""Sets the channel for bot chatter."""
isAdmin = ctx.message.author.permissions_in(ctx.message.channel).administrator
# 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 channel == None:
self.settings.setServerStat(ctx.message.server, "ChatChannel", "")
msg = 'Chat channel removed - must use the `{}chat [message]` command to chat.'.format(ctx.prefix)
await self.bot.send_message(ctx.message.channel, msg)
return
# If we made it this far - then we can add it
self.settings.setServerStat(ctx.message.server, "ChatChannel", channel.id)
msg = 'Chat channel set to **{}**.'.format(channel.name)
await self.bot.send_message(ctx.message.channel, msg)
评论列表
文章目录