Browse Source

fixed another issue with trivia error handling and fixed bug where roxbot would delete its own content.

tags/v2.1.2
Roxie Gibson 5 years ago
parent
commit
dff136ab36
4 changed files with 11 additions and 5 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +1
    -1
      roxbot/__init__.py
  3. +3
    -2
      roxbot/cogs/trivia.py
  4. +3
    -2
      roxbot/core.py

+ 4
- 0
CHANGELOG.md View File

@@ -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

+ 1
- 1
roxbot/__init__.py View File

@@ -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.

+ 3
- 2
roxbot/cogs/trivia.py View File

@@ -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

+ 3
- 2
roxbot/core.py View File

@@ -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)

Loading…
Cancel
Save