Added !contact, !info

!contact allows the user to send a message to the bot's owner
!info shows info about Red
This commit is contained in:
Twentysix 2016-06-19 00:49:51 +02:00
parent fc93b02639
commit 076dd93904

View File

@ -128,7 +128,7 @@ class Owner:
await self.bot.say("I was unable to unload some cogs: " await self.bot.say("I was unable to unload some cogs: "
"{}".format(still_loaded)) "{}".format(still_loaded))
else: else:
await self.bot.say("All cogs are now unloaded.") await self.bot.say("All cogs are now unloaded.")
@checks.is_owner() @checks.is_owner()
@commands.command(name="reload") @commands.command(name="reload")
@ -462,6 +462,35 @@ class Owner:
else: else:
break break
@commands.command(pass_context=True)
async def contact(self, ctx, *, message : str):
"""Sends message to the owner"""
if settings.owner == "id_here":
await self.bot.say("I have no owner set.")
return
owner = discord.utils.get(self.bot.get_all_members(), id=settings.owner)
author = ctx.message.author
sender = "From {} ({}):\n\n".format(author, author.id)
message = sender + message
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.")
@commands.command()
async def info(self):
"""Shows info about Red"""
await self.bot.say(
"This is an instance of Red, an open source Discord bot created by "
"Twentysix and improved by many.\n\n**Github:**\n"
"<https://github.com/Twentysix26/Red-DiscordBot/>\n"
"**Official server:**\n<https://discord.me/Red-DiscordBot>")
async def leave_confirmation(self, server, owner, ctx): async def leave_confirmation(self, server, owner, ctx):
if not ctx.message.channel.is_private: if not ctx.message.channel.is_private:
current_server = ctx.message.server current_server = ctx.message.server
@ -564,4 +593,4 @@ def check_files():
def setup(bot): def setup(bot):
check_files() check_files()
n = Owner(bot) n = Owner(bot)
bot.add_cog(n) bot.add_cog(n)