File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 29
29
import datetime
30
30
import os
31
31
import re
32
+ from types import SimpleNamespace
32
33
33
34
import discord
34
35
import aiohttp
35
36
from discord .ext import commands
36
37
from discord .ext .commands .view import StringView
37
38
from colorama import init , Fore , Style
39
+ import emoji
38
40
39
41
from core .api import Github , ModmailApiClient
40
42
from core .thread import ThreadManager
@@ -182,12 +184,29 @@ async def on_ready(self):
182
184
else :
183
185
await self .threads .populate_cache ()
184
186
187
+
188
+
185
189
async def process_modmail (self , message ):
186
190
"""Processes messages sent to the bot."""
187
191
192
+ ctx = SimpleNamespace (bot = self , guild = self .modmail_guild )
193
+ converter = commands .EmojiConverter ()
194
+
188
195
blocked_emoji = self .config .get ('blocked_emoji' , '🚫' )
189
196
sent_emoji = self .config .get ('sent_emoji' , '✅' )
190
197
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
+
191
210
reaction = blocked_emoji if message .author .id in self .blocked_users else sent_emoji
192
211
193
212
try :
Original file line number Diff line number Diff line change 3
3
cachetools
4
4
python-dateutil
5
5
python-box
6
- colorthief
6
+ colorthief
7
+ emoji
You can’t perform that action at this time.
0 commit comments