File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 2929import datetime
3030import os
3131import re
32+ from types import SimpleNamespace
3233
3334import discord
3435import aiohttp
3536from discord .ext import commands
3637from discord .ext .commands .view import StringView
3738from colorama import init , Fore , Style
39+ import emoji
3840
3941from core .api import Github , ModmailApiClient
4042from core .thread import ThreadManager
@@ -182,12 +184,29 @@ async def on_ready(self):
182184 else :
183185 await self .threads .populate_cache ()
184186
187+
188+
185189 async def process_modmail (self , message ):
186190 """Processes messages sent to the bot."""
187191
192+ ctx = SimpleNamespace (bot = self , guild = self .modmail_guild )
193+ converter = commands .EmojiConverter ()
194+
188195 blocked_emoji = self .config .get ('blocked_emoji' , '🚫' )
189196 sent_emoji = self .config .get ('sent_emoji' , '✅' )
190197
198+ if blocked_emoji not in emoji .UNICODE_EMOJI :
199+ try :
200+ blocked_emoji = await converter .convert (ctx , blocked_emoji .strip (':' ))
201+ except :
202+ pass
203+
204+ if sent_emoji not in emoji .UNICODE_EMOJI :
205+ try :
206+ sent_emoji = await converter .convert (ctx , sent_emoji .strip (':' ))
207+ except :
208+ pass
209+
191210 reaction = blocked_emoji if message .author .id in self .blocked_users else sent_emoji
192211
193212 try :
Original file line number Diff line number Diff line change 33cachetools
44python-dateutil
55python-box
6- colorthief
6+ colorthief
7+ emoji
You can’t perform that action at this time.
0 commit comments