Skip to content

Commit 5fe2434

Browse files
committed
Fixed interguild communication
1 parent fcca745 commit 5fe2434

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

bot.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,19 @@ def format_info(self, user):
171171
'''Get information about a member of a server'''
172172
server = self.guild
173173
member = self.guild.get_member(user.id)
174-
avi = member.avatar_url
174+
avi = user.avatar_url
175175
time = datetime.datetime.utcnow()
176176
desc = 'Modmail thread started.'
177177
color = 0
178178

179179
if member:
180+
roles = sorted(member.roles, key=lambda c: c.position)
181+
rolenames = ', '.join([r.name for r in roles if r.name != "@everyone"]) or 'None'
182+
member_number = sorted(server.members, key=lambda m: m.joined_at).index(member) + 1
180183
for role in roles:
181184
if str(role.color) != "#000000":
182185
color = role.color
183-
186+
184187
em = discord.Embed(colour=color, description=desc, timestamp=time)
185188

186189
em.add_field(name='Account Created', value=str((time - user.created_at).days)+' days ago.')
@@ -189,10 +192,6 @@ def format_info(self, user):
189192
em.set_author(name=user, icon_url=server.icon_url)
190193

191194
if member:
192-
roles = sorted(member.roles, key=lambda c: c.position)
193-
rolenames = ', '.join([r.name for r in roles if r.name != "@everyone"]) or 'None'
194-
member_number = sorted(server.members, key=lambda m: m.joined_at).index(member) + 1
195-
196195
em.add_field(name='Joined', value=str((time - member.joined_at).days)+' days ago.')
197196
em.add_field(name='Member No.',value=str(member_number),inline = True)
198197
em.add_field(name='Nick', value=member.nick, inline=True)
@@ -215,7 +214,10 @@ async def send_mail(self, message, channel):
215214
await channel.send(fmt, embed=embed)
216215

217216
async def process_reply(self, message):
218-
await message.delete()
217+
try:
218+
await message.delete()
219+
except discord.errors.NotFound:
220+
pass
219221
await self.send_mail(message, message.channel)
220222
user_id = int(message.channel.topic.split(': ')[1])
221223
user = self.get_user(user_id)

0 commit comments

Comments
 (0)