Merge branch 'feature/fix-missing-returns'

master
Tristan Gosselin-Hane 6 years ago
commit 346eba1189
No known key found for this signature in database
GPG Key ID: 0B7E55B60DCA15D5
  1. 8
      minecraft_discord_bridge/minecraft_discord_bridge.py

@ -101,6 +101,7 @@ class MinecraftDiscordBridge():
send_channel = message.author.dm_channel send_channel = message.author.dm_channel
msg = self.get_discord_help_string() msg = self.get_discord_help_string()
await send_channel.send(msg) await send_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)
@ -136,6 +137,7 @@ class MinecraftDiscordBridge():
session.close() session.close()
del session del session
await send_channel.send(msg) await send_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)
@ -159,6 +161,7 @@ class MinecraftDiscordBridge():
dm_channel = message.author.dm_channel dm_channel = message.author.dm_channel
msg = "Sorry, you do not have permission to execute that command!" msg = "Sorry, you do not have permission to execute that command!"
await dm_channel.send(msg) await dm_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)
@ -197,6 +200,7 @@ class MinecraftDiscordBridge():
dm_channel = message.author.dm_channel dm_channel = message.author.dm_channel
msg = "Sorry, you do not have permission to execute that command!" msg = "Sorry, you do not have permission to execute that command!"
await dm_channel.send(msg) await dm_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)
@ -242,6 +246,7 @@ class MinecraftDiscordBridge():
self.strip_colour(player_list)), self.escape_markdown( self.strip_colour(player_list)), self.escape_markdown(
self.strip_colour(self.tab_footer))) self.strip_colour(self.tab_footer)))
await send_channel.send(msg) await send_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)
@ -262,6 +267,7 @@ class MinecraftDiscordBridge():
send_channel = message.author.dm_channel send_channel = message.author.dm_channel
msg = "Unknown command, type `mc!help` for a list of commands." msg = "Unknown command, type `mc!help` for a list of commands."
await send_channel.send(msg) await send_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)
@ -314,6 +320,7 @@ class MinecraftDiscordBridge():
send_channel = message.author.dm_channel send_channel = message.author.dm_channel
msg = "Your message \"{}\" has been rate-limited.".format(message.clean_content) msg = "Your message \"{}\" has been rate-limited.".format(message.clean_content)
await send_channel.send(msg) await send_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format( msg = "{}, please allow private messages from this bot.".format(
@ -354,6 +361,7 @@ class MinecraftDiscordBridge():
msg = "Unable to send chat message: there is no Minecraft account linked to this discord " \ msg = "Unable to send chat message: there is no Minecraft account linked to this discord " \
"account, please run `mc!register`." "account, please run `mc!register`."
await send_channel.send(msg) await send_channel.send(msg)
return
except discord.errors.Forbidden: except discord.errors.Forbidden:
if isinstance(message.author, discord.abc.User): if isinstance(message.author, discord.abc.User):
msg = "{}, please allow private messages from this bot.".format(message.author.mention) msg = "{}, please allow private messages from this bot.".format(message.author.mention)

Loading…
Cancel
Save