Fix for !join on OAuth bots (#157)

Fix for !join on OAuth bots
This commit is contained in:
Kowlin 2016-04-16 00:06:49 +02:00 committed by Twentysix
parent d291770499
commit 1b8f6d26ad

17
red.py
View File

@ -262,13 +262,16 @@ async def shutdown():
@checks.is_owner() @checks.is_owner()
async def join(invite_url : discord.Invite): async def join(invite_url : discord.Invite):
"""Joins new server""" """Joins new server"""
try: if bot.user.bot == True:
await bot.accept_invite(invite_url) bot.say("I cannot join servers with invite link. Please use a OAuth link.")
await bot.say("Server joined.") else:
except discord.NotFound: try:
await bot.say("The invite was invalid or expired.") await bot.accept_invite(invite_url)
except discord.HTTPException: await bot.say("Server joined.")
await bot.say("I wasn't able to accept the invite. Try again.") except discord.NotFound:
await bot.say("The invite was invalid or expired.")
except discord.HTTPException:
await bot.say("I wasn't able to accept the invite. Try again.")
@bot.command(pass_context=True) @bot.command(pass_context=True)
@checks.is_owner() @checks.is_owner()