@@ -55,23 +55,21 @@ async def mute(
55
55
if not status :
56
56
return await embeds .send_error (ctx = ctx , description = "Unable to decipher duration, please try again" )
57
57
58
- # TODO: Apparently arrow expects struct to be UTC but it's based on the local time instead which throws it off
59
- muted_until = arrow .get (* struct [:6 ], tzinfo = arrow .now ().tzinfo .zone )
60
- logger .info (f"Before: { muted_until } " )
61
- logger .info (f"After: { muted_until .to ('utc' )} " )
62
-
58
+ # arrow will assume the struct is in UTC unless we manually set the timezone to the system timezone
59
+ # and then convert it to UTC afterwards. We shouldn't need to do this again unless using parsedatetime.
60
+ muted_until = arrow .get (* struct [:6 ]).replace (tzinfo = arrow .now ().tzinfo ).to ("utc" )
63
61
if muted_until >= arrow .utcnow ().shift (days = + 28 ):
64
62
return await embeds .send_error (ctx = ctx , description = "Timeout duration cannot exceed 28 days." )
65
63
66
64
mod_embed = embeds .make_embed (
67
65
ctx = ctx ,
68
- title = f"Muting member: { member } " ,
66
+ title = "Muted member" ,
69
67
description = f"{ member .mention } was muted by { ctx .user .mention } for: { reason } " ,
70
68
thumbnail_url = "https://files.catbox.moe/6rs4fn.png" ,
71
- color = discord . Color . red () ,
69
+ color = 0xCD6D6D ,
72
70
fields = [
73
- {"name" : "Duration:" , "value" : muted_until .humanize (), "inline" : True },
74
71
{"name" : "Expires:" , "value" : f"<t:{ int (muted_until .timestamp ())} :R>" , "inline" : True },
72
+ {"name" : "Reason:" , "value" : reason , "inline" : False },
75
73
],
76
74
)
77
75
@@ -90,15 +88,7 @@ async def mute(
90
88
try :
91
89
await member .send (embed = user_embed )
92
90
except (discord .Forbidden , discord .HTTPException ):
93
- mod_embed .add_field (
94
- name = "Notice:" ,
95
- value = (
96
- f"Unable to message { member .mention } about this action. "
97
- "This can be caused by the user not being in the server, "
98
- "having DMs disabled, or having the bot blocked."
99
- ),
100
- inline = False ,
101
- )
91
+ mod_embed .set_footer (text = "⚠️ Unable to message user about this action." )
102
92
103
93
ModLog (
104
94
user_id = member .id ,
@@ -148,10 +138,13 @@ async def unmute(
148
138
149
139
mod_embed = embeds .make_embed (
150
140
ctx = ctx ,
151
- title = f"Unmuting member: { member . name } " ,
152
- description = f"{ member .mention } was unmuted by { ctx .user .mention } for: { reason } " ,
141
+ title = "Unmuted member" ,
142
+ description = f"{ member .mention } was unmuted by { ctx .user .mention } " ,
153
143
color = discord .Color .green (),
154
144
thumbnail_url = "https://files.catbox.moe/izm83m.png" ,
145
+ fields = [
146
+ {"name" : "Reason:" , "value" : reason , "inline" : False },
147
+ ],
155
148
)
156
149
157
150
user_embed = embeds .make_embed (
@@ -161,27 +154,19 @@ async def unmute(
161
154
image_url = "https://files.catbox.moe/razmf6.gif" ,
162
155
color = discord .Color .blurple (),
163
156
fields = [
164
- {"name" : "Server:" , "value" : f"[ { ctx .guild .name } ]( { await ctx . guild . vanity_invite () } )" , "inline" : True },
157
+ {"name" : "Server:" , "value" : ctx .guild .name , "inline" : True },
165
158
{"name" : "Reason:" , "value" : reason , "inline" : False },
166
159
],
167
160
)
168
161
try :
169
162
await member .send (embed = user_embed )
170
163
except (discord .Forbidden , discord .HTTPException ):
171
- mod_embed .add_field (
172
- name = "Notice:" ,
173
- value = (
174
- f"Unable to message { member .mention } about this action. "
175
- "This can be caused by the user not being in the server, "
176
- "having DMs disabled, or having the bot blocked."
177
- ),
178
- inline = False ,
179
- )
164
+ mod_embed .set_footer (text = "⚠️ Unable to message user about this action." )
180
165
181
166
ModLog (
182
167
user_id = member .id ,
183
168
mod_id = ctx .user .id ,
184
- timestamp = arrow .now ().int_timestamp ,
169
+ timestamp = arrow .utcnow ().int_timestamp ,
185
170
reason = reason ,
186
171
type = "unmute" ,
187
172
).save ()
@@ -198,10 +183,11 @@ async def on_member_update(self, before: discord.Member, after: discord.Member)
198
183
if not before .timed_out_until and after .timed_out_until :
199
184
logs = [log async for log in after .guild .audit_logs (limit = 1 , action = discord .AuditLogAction .member_update )]
200
185
if logs [0 ].user != self .bot .user :
186
+ # TODO: need to log duration here
201
187
ModLog (
202
188
user_id = after .id ,
203
189
mod_id = logs [0 ].user .id ,
204
- timestamp = arrow .now ().int_timestamp ,
190
+ timestamp = arrow .utcnow ().int_timestamp ,
205
191
reason = logs [0 ].reason ,
206
192
type = "mute" ,
207
193
).save ()
@@ -212,7 +198,7 @@ async def on_member_update(self, before: discord.Member, after: discord.Member)
212
198
ModLog (
213
199
user_id = after .id ,
214
200
mod_id = logs [0 ].user .id ,
215
- timestamp = arrow .now ().int_timestamp ,
201
+ timestamp = arrow .utcnow ().int_timestamp ,
216
202
reason = logs [0 ].reason ,
217
203
type = "unmute" ,
218
204
)
0 commit comments