@@ -155,21 +155,27 @@ async def snooze(self, moderator=None, command_used=None):
155
155
"attachments" : [a .url for a in m .attachments ],
156
156
"embeds" : [e .to_dict () for e in m .embeds ],
157
157
"created_at" : m .created_at .isoformat (),
158
- # Only use 'mod_only' if this is an internal note (note command)
158
+ # Only use 'mod_only' if this is an internal note (note command), safe check for embed author
159
159
"type" : (
160
160
"mod_only"
161
- if m .embeds and hasattr (m .embeds [0 ], 'author' ) and (
162
- getattr (m .embeds [0 ].author , 'name' , '' ).startswith ('Note' ) or
163
- getattr (m .embeds [0 ].author , 'name' , '' ).startswith ('Persistent Note' )
161
+ if (
162
+ m .embeds
163
+ and getattr (m .embeds [0 ], 'author' , None )
164
+ and (
165
+ getattr (m .embeds [0 ].author , 'name' , '' ).startswith ('Note' ) or
166
+ getattr (m .embeds [0 ].author , 'name' , '' ).startswith ('Persistent Note' )
167
+ )
164
168
)
165
169
else None
166
170
),
167
171
"author_name" : getattr (m .author , "name" , None ),
168
172
}
169
173
async for m in channel .history (limit = None , oldest_first = True )
170
- # Only include if not already internal/note
174
+ # Only include if not already internal/note, safe check for embed author
171
175
if not (
172
- m .embeds and hasattr (m .embeds [0 ], 'author' ) and (
176
+ m .embeds
177
+ and getattr (m .embeds [0 ], 'author' , None )
178
+ and (
173
179
getattr (m .embeds [0 ].author , 'name' , '' ).startswith ('Note' ) or
174
180
getattr (m .embeds [0 ].author , 'name' , '' ).startswith ('Persistent Note' )
175
181
)
0 commit comments