@@ -199,7 +199,7 @@ async def register_commands(self) -> None:
199
199
to_update = update_guild_commands [guild_id ]
200
200
update_guild_commands [guild_id ] = to_update + [as_dict ]
201
201
202
- for guild_id in update_guild_commands :
202
+ for guild_id , guild_data in update_guild_commands . items () :
203
203
try :
204
204
cmds = await self .http .bulk_upsert_guild_commands (
205
205
self .user .id , guild_id , update_guild_commands [guild_id ]
@@ -208,11 +208,10 @@ async def register_commands(self) -> None:
208
208
# Permissions for this Guild
209
209
guild_permissions : List = []
210
210
except Forbidden :
211
- if not update_guild_commands [ guild_id ] :
211
+ if not guild_data :
212
212
continue
213
- else :
214
- print (f"Failed to add command to guild { guild_id } " , file = sys .stderr )
215
- raise
213
+ print (f"Failed to add command to guild { guild_id } " , file = sys .stderr )
214
+ raise
216
215
else :
217
216
for i in cmds :
218
217
cmd = get (
@@ -261,16 +260,14 @@ async def register_commands(self) -> None:
261
260
for permission in item ["permissions" ]:
262
261
if isinstance (permission ["id" ], str ):
263
262
# Replace Role Names
264
- if permission ["type" ] == 1 and isinstance (
265
- permission ["id" ], str
266
- ):
263
+ if permission ["type" ] == 1 :
267
264
role = get (
268
265
self .get_guild (guild_id ).roles ,
269
266
name = permission ["id" ],
270
267
)
271
268
272
269
# If not missing
273
- if not role is None :
270
+ if role is not None :
274
271
new_cmd_perm ["permissions" ].append (
275
272
{
276
273
"id" : role .id ,
@@ -284,7 +281,7 @@ async def register_commands(self) -> None:
284
281
guild_id = guild_id , role = permission ["id" ]
285
282
)
286
283
)
287
- # Add Owner IDs
284
+ # Add owner IDs
288
285
elif (
289
286
permission ["type" ] == 2 and permission ["id" ] == "owner"
290
287
):
@@ -306,7 +303,7 @@ async def register_commands(self) -> None:
306
303
"permission" : permission ["permission" ],
307
304
}
308
305
)
309
- # Add the Rest
306
+ # Add the rest
310
307
else :
311
308
new_cmd_perm ["permissions" ].append (permission )
312
309
@@ -647,7 +644,7 @@ def remove_check(self, func, *, call_once: bool = False) -> None:
647
644
648
645
try :
649
646
l .remove (func )
650
- except ValueError :
647
+ except guild_dataError :
651
648
pass
652
649
653
650
def check_once (self , func ):
0 commit comments