@@ -1,3 +1,7 @@ | |||
## v2.1.2 | |||
- Fixed bug where Roxbot's delete function would delete itself. | |||
- Fixed more trivia error handling | |||
## v2.1.1 | |||
#### Bug Fixes |
@@ -12,7 +12,7 @@ __title__ = "roxbot" | |||
__author__ = "Roxanne Gibson" | |||
__license__ = "MIT" | |||
__copyright__ = "Copyright 2015-2017 Roxanne Gibson <me@roxxers.xyz>" | |||
__version__ = "2.1.1" | |||
__version__ = "2.1.2" | |||
__description__ = """Roxbot: An inclusive modular multi-purpose Discord bot. Built with love (and discord.py) by Roxxers#7443. | |||
Roxbot is designed be a multi-purpose bot and provide many different services for users and moderators alike with a focus on customisability. |
@@ -54,6 +54,7 @@ class Trivia: | |||
self.error_colour = roxbot.EmbedColours.dark_red | |||
self.trivia_colour = roxbot.EmbedColours.blue | |||
self.bot.add_listener(self._emoji_vars, "on_ready") | |||
self.bot.add_listener(self.game_reation, "on_reaction_add") | |||
async def _emoji_vars(self): | |||
a_emoji = self.bot.get_emoji(419572828854026252) or "🇦" | |||
@@ -282,7 +283,7 @@ class Trivia: | |||
# Discord Events | |||
async def on_reaction_add(self, reaction, user): | |||
async def game_reation(self, reaction, user): | |||
"""Logic for answering a question""" | |||
time = datetime.datetime.now() | |||
if user == self.bot.user: | |||
@@ -292,7 +293,7 @@ class Trivia: | |||
message = reaction.message | |||
try: | |||
reaction_is_on_question = bool(message.id == self.games[channel.id]["current_question"].id) | |||
except AttributeError: | |||
except (AttributeError, KeyError): | |||
if reaction.emoji in self.emojis: | |||
# This means the question isn't ready | |||
reaction_is_on_question = False |
@@ -73,10 +73,11 @@ class Roxbot(commands.Bot): | |||
""" | |||
if not delete_emoji: | |||
delete_emoji = "❌" | |||
await message.add_reaction(delete_emoji) | |||
def check(r, u): | |||
return str(r) == str(delete_emoji) and u == message.author and r.message.id == message.id | |||
return str(r) == str(delete_emoji) and u != message.author and r.message.id == message.id | |||
await message.add_reaction(delete_emoji) | |||
try: | |||
await self.wait_for("reaction_add", timeout=timeout, check=check) |