def suggest(self, ctx, *, suggestion : str):
"""Sends a suggestion to the owner."""
if settings.owner == "id_here":
await self.bot.say("I have no owner set, cannot suggest.")
return
owner = discord.utils.get(self.bot.get_all_members(), id=settings.owner)
author = ctx.message.author
if ctx.message.channel.is_private is False:
server = ctx.message.server
source = "server **{}** ({})".format(server.name, server.id)
else:
source = "direct message"
sender = "**{}** ({}) sent you a suggestion from {}:\n\n".format(author, author.id, source)
message = sender + suggestion
try:
await self.bot.send_message(owner, message)
except discord.errors.InvalidArgument:
await self.bot.say("I cannot send your message, I'm unable to find"
" my owner... *sigh*")
except discord.errors.HTTPException:
await self.bot.say("Your message is too long.")
except:
await self.bot.say("I'm unable to deliver your message. Sorry.")
else:
await self.bot.say("Your message has been sent.")
评论列表
文章目录