## v2.1.2 | |||||
- Fixed bug where Roxbot's delete function would delete itself. | |||||
- Fixed more trivia error handling | |||||
## v2.1.1 | ## v2.1.1 | ||||
#### Bug Fixes | #### Bug Fixes |
__author__ = "Roxanne Gibson" | __author__ = "Roxanne Gibson" | ||||
__license__ = "MIT" | __license__ = "MIT" | ||||
__copyright__ = "Copyright 2015-2017 Roxanne Gibson <me@roxxers.xyz>" | __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. | __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. | Roxbot is designed be a multi-purpose bot and provide many different services for users and moderators alike with a focus on customisability. |
self.error_colour = roxbot.EmbedColours.dark_red | self.error_colour = roxbot.EmbedColours.dark_red | ||||
self.trivia_colour = roxbot.EmbedColours.blue | self.trivia_colour = roxbot.EmbedColours.blue | ||||
self.bot.add_listener(self._emoji_vars, "on_ready") | self.bot.add_listener(self._emoji_vars, "on_ready") | ||||
self.bot.add_listener(self.game_reation, "on_reaction_add") | |||||
async def _emoji_vars(self): | async def _emoji_vars(self): | ||||
a_emoji = self.bot.get_emoji(419572828854026252) or "🇦" | a_emoji = self.bot.get_emoji(419572828854026252) or "🇦" | ||||
# Discord Events | # Discord Events | ||||
async def on_reaction_add(self, reaction, user): | |||||
async def game_reation(self, reaction, user): | |||||
"""Logic for answering a question""" | """Logic for answering a question""" | ||||
time = datetime.datetime.now() | time = datetime.datetime.now() | ||||
if user == self.bot.user: | if user == self.bot.user: | ||||
message = reaction.message | message = reaction.message | ||||
try: | try: | ||||
reaction_is_on_question = bool(message.id == self.games[channel.id]["current_question"].id) | 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: | if reaction.emoji in self.emojis: | ||||
# This means the question isn't ready | # This means the question isn't ready | ||||
reaction_is_on_question = False | reaction_is_on_question = False |
""" | """ | ||||
if not delete_emoji: | if not delete_emoji: | ||||
delete_emoji = "❌" | delete_emoji = "❌" | ||||
await message.add_reaction(delete_emoji) | |||||
def check(r, u): | 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: | try: | ||||
await self.wait_for("reaction_add", timeout=timeout, check=check) | await self.wait_for("reaction_add", timeout=timeout, check=check) |