Skip to content

Commit 2414b04

Browse files
Merge pull request #64 from Pycord-Development/slash
Minor fixes
2 parents 18283a7 + 2b17cff commit 2414b04

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

discord/app/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, func: Callable, *args, **kwargs) -> None:
6868
self.name: str = name
6969

7070
description = kwargs.get("description") or (
71-
inspect.cleandoc(func.__doc__)
71+
inspect.cleandoc(func.__doc__).splitlines()[0]
7272
if func.__doc__ is not None
7373
else "No description provided"
7474
)

discord/bot.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
from typing import Callable, Optional
2828

29-
import traceback
3029
import sys
3130

3231
from .client import Client
@@ -192,21 +191,20 @@ async def register_commands(self) -> None:
192191
to_update = update_guild_commands[guild_id]
193192
update_guild_commands[guild_id] = to_update + [as_dict]
194193

195-
raised_error = None
196-
raised_guilds = []
197194
for guild_id in update_guild_commands:
198195
try:
199196
cmds = await self.http.bulk_upsert_guild_commands(self.user.id, guild_id,
200197
update_guild_commands[guild_id])
198+
except Forbidden:
199+
if not update_guild_commands[guild_id]:
200+
continue
201+
else:
202+
print(f"Failed to add command to guild {guild_id}", file=sys.stderr)
203+
raise
204+
else:
201205
for i in cmds:
202206
cmd = get(self.to_register, name=i["name"], description=i["description"], type=i['type'])
203207
self.app_commands[i["id"]] = cmd
204-
except Forbidden:
205-
raised_error = raised_error or traceback.format_exc()
206-
raised_guilds.append(guild_id)
207-
if raised_error:
208-
print(f'Ignoring exception running bulk_upsert_guild_commands on guilds {raised_guilds}', file=sys.stderr)
209-
print(raised_error, file=sys.stderr)
210208

211209
cmds = await self.http.bulk_upsert_global_commands(self.user.id, commands)
212210

0 commit comments

Comments
 (0)