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

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

+ 1
- 1
roxbot/__init__.py View File

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

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

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

+ 3
- 2
roxbot/core.py View File

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

Loading…
Cancel
Save