Skip to content

Commit

Permalink
Merge pull request #202 from GTG3000/master
Browse files Browse the repository at this point in the history
Implemented raw reaction events
  • Loading branch information
medeor413 authored Sep 25, 2020
2 parents 8134cf9 + 1edb88f commit c73440c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions red_star/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from asyncio import create_task, sleep
from datetime import datetime
from discord import AutoShardedClient, DMChannel
from discord.object import Object
from discord.utils import oauth_url
from pathlib import Path
from sys import exc_info
Expand Down Expand Up @@ -109,13 +110,31 @@ async def on_reaction_add(self, reaction, user):
return
await self.plugin_manager.hook_event("on_reaction_add", reaction, user)

async def on_raw_reaction_add(self, payload):
if payload.channel_id is not None \
and self.channel_manager.channel_in_category(
Object(payload.guild_id),
"no_read",
Object(payload.channel_id)):
return
await self.plugin_manager.hook_event("on_raw_reaction_add", payload)

async def on_reaction_remove(self, reaction, user):
if reaction.message.guild is None:
return
if self.channel_manager.channel_in_category(reaction.message.guild, "no_read", reaction.message.channel):
return
await self.plugin_manager.hook_event("on_reaction_remove", reaction, user)

async def on_raw_reaction_remove(self, payload):
if payload.channel_id is not None \
and self.channel_manager.channel_in_category(
Object(payload.guild_id),
"no_read",
Object(payload.channel_id)):
return
await self.plugin_manager.hook_event("on_raw_reaction_remove", payload)

async def on_reaction_clear(self, message, reactions):
if message.guild is None:
return
Expand Down

0 comments on commit c73440c

Please sign in to comment.