File tree 3 files changed +25
-12
lines changed
3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
5
5
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6
6
7
+ #v2.0.4
8
+
9
+ ### Fixed
10
+ - Fixed a one off bug where the channel topic dissapears, but modmail operations should still continue
11
+ - Fixed linked_message_id issues.
12
+
7
13
# v2.0.3
8
14
9
15
Fixed some issues with how data is displayed in the info embed.
Original file line number Diff line number Diff line change 22
22
SOFTWARE.
23
23
"""
24
24
25
- __version__ = '2.0.3 '
25
+ __version__ = '2.0.4 '
26
26
27
27
import asyncio
28
28
import textwrap
@@ -120,10 +120,14 @@ def modmail_guild(self):
120
120
return self .guild
121
121
else :
122
122
return discord .utils .get (self .guilds , id = int (modmail_guild_id ))
123
+
124
+ @property
125
+ def using_multiple_server_setup (self ):
126
+ return self .modmail_guild != self .guild
123
127
124
128
@property
125
129
def main_category (self ):
126
- if self .guild :
130
+ if self .modmail_guild :
127
131
return discord .utils .get (self .modmail_guild .categories , name = 'Mod Mail' )
128
132
129
133
@property
@@ -245,7 +249,7 @@ async def on_message_delete(self, message):
245
249
"""Support for deleting linked messages"""
246
250
if message .embeds and not isinstance (message .channel , discord .DMChannel ):
247
251
message_id = str (message .embeds [0 ].author .url ).split ('/' )[- 1 ]
248
- if matches :
252
+ if message_id . isdigit () :
249
253
thread = await self .threads .find (channel = message .channel )
250
254
251
255
channel = thread .recipient .dm_channel
Original file line number Diff line number Diff line change @@ -135,8 +135,11 @@ def __init__(self, bot):
135
135
136
136
async def populate_cache (self ):
137
137
for channel in self .bot .modmail_guild .text_channels :
138
+ if not self .bot .using_multiple_server_setup and channel .category != self .main_category :
139
+ continue
138
140
await self .find (channel = channel )
139
141
142
+
140
143
def __len__ (self ):
141
144
return len (self .cache )
142
145
@@ -177,15 +180,15 @@ async def _find_from_channel(self, channel):
177
180
if channel .topic and 'User ID: ' in channel .topic :
178
181
user_id = int (re .findall (r'\d+' , channel .topic )[0 ])
179
182
180
- # BUG: This wont work with multiple categories.
181
- # elif channel.topic is None:
182
- # async for message in channel.history(limit=50):
183
- # if message.embeds:
184
- # em = message.embeds[0]
185
- # matches = re.findall(r'<@ (\d+)> ', str(em.description ))
186
- # if matches:
187
- # user_id = int(matches[-1 ])
188
- # break
183
+ # BUG: When discord fails to create channel topic. search through message history
184
+ elif channel .topic is None :
185
+ async for message in channel .history (limit = 50 ):
186
+ if message .embeds :
187
+ em = message .embeds [0 ]
188
+ matches = re .findall (r'User ID: (\d+)' , str (em .footer . text ))
189
+ if matches :
190
+ user_id = int (matches [0 ])
191
+ break
189
192
190
193
if user_id is not None :
191
194
if user_id in self .cache :
You can’t perform that action at this time.
0 commit comments