diff --git a/admin_ext/ban.py b/admin_ext/ban.py index 9b4b1b7..ece6ea5 100644 --- a/admin_ext/ban.py +++ b/admin_ext/ban.py @@ -10,6 +10,7 @@ class Extension: reason: str, minutes: int = 0 ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) player = await core.GetPlayer(profile, steam64, False) - return await interaction.response.send_message(f'{await player.ban(reason, minutes)}', ephemeral=False) \ No newline at end of file + return await interaction.followup.send(f'{await player.ban(reason, minutes)}', ephemeral=False) \ No newline at end of file diff --git a/admin_ext/kick.py b/admin_ext/kick.py index 9beea94..ee9ab3c 100644 --- a/admin_ext/kick.py +++ b/admin_ext/kick.py @@ -9,6 +9,7 @@ class Extension: profile: str, reason: str = "" ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) player = await core.GetPlayer(profile, steam64, False) - return await interaction.response.send_message(f'{await player.kick(reason)}', ephemeral=False) \ No newline at end of file + return await interaction.followup.send(f'{await player.kick(reason)}', ephemeral=False) \ No newline at end of file diff --git a/admin_ext/rcon.py b/admin_ext/rcon.py index f042725..7f14b10 100644 --- a/admin_ext/rcon.py +++ b/admin_ext/rcon.py @@ -10,10 +10,11 @@ class Extension: server: str, command: str ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) if not server in core.stats.get("servers", {}).keys(): - return await interaction.response.send_message(f"Сервер с таким индификатором не существует, введи существующий из предложенных:\n{' '.join(core.stats.get('servers', {}).keys())}", ephemeral=False) + return await interaction.followup.send(f"Сервер с таким индификатором не существует, введи существующий из предложенных:\n{' '.join(core.stats.get('servers', {}).keys())}", ephemeral=False) async with aiohttp.ClientSession(cookies={"secretkey":core.secret_key, "steam64":steam64}) as session: async with session.post(f"{core.backend_url}/api/admin/rcon?srv={server}&command={command}", ssl=False) as response: - return await interaction.response.send_message(f'{await response.text()}', ephemeral=False) \ No newline at end of file + return await interaction.followup.send(f'{await response.text()}', ephemeral=False) \ No newline at end of file diff --git a/admin_ext/unban.py b/admin_ext/unban.py index 9625bc1..75fd45c 100644 --- a/admin_ext/unban.py +++ b/admin_ext/unban.py @@ -8,6 +8,7 @@ class Extension: interaction: discord.Interaction, profile: str ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) player = await core.GetPlayer(profile, steam64, False) - return await interaction.response.send_message(f'{await player.unban()}', ephemeral=False) \ No newline at end of file + return await interaction.followup.send(f'{await player.unban()}', ephemeral=False) \ No newline at end of file diff --git a/admin_ext/use.py b/admin_ext/use.py index 9cab75f..f2ac289 100644 --- a/admin_ext/use.py +++ b/admin_ext/use.py @@ -10,6 +10,7 @@ class Extension: profile: str, args: str = "" ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) player = await core.GetPlayer(profile, steam64) - return await interaction.response.send_message(f'{await player.rcon(command, args)}', ephemeral=False) \ No newline at end of file + return await interaction.followup.send(f'{await player.rcon(command, args)}', ephemeral=False) \ No newline at end of file diff --git a/bot.py b/bot.py index ea03231..deca2e5 100644 --- a/bot.py +++ b/bot.py @@ -57,18 +57,19 @@ class DiscordClient(discord.Client): @self.tree.error async def on_app_command_error(interaction, error): if isinstance(error.original, CannotCastToSteamID): - return await interaction.response.send_message("Не возможно найти такой профиль, попробуй написать иные данные!", ephemeral=True) + return await interaction.followup.send("Не возможно найти такой профиль, попробуй написать иные данные!", ephemeral=True) elif isinstance(error.original, LowPermition): - return await interaction.response.send_message("Это не для тебя и не для таких как ты сделано...", ephemeral=True) + return await interaction.followup.send("Это не для тебя и не для таких как ты сделано...", ephemeral=True) elif isinstance(error.original, AdminLowPermition): - return await interaction.response.send_message("Нельзя сделать это действие, ибо ты крут, но не настолько чтоб это совершить", ephemeral=True) + return await interaction.followup.send("Нельзя сделать это действие, ибо ты крут, но не настолько чтоб это совершить", ephemeral=True) elif isinstance(error.original, NotFoundPlayerOnServer): - return await interaction.response.send_message("Игрок не найден на серверах", ephemeral=True) + return await interaction.followup.send("Игрок не найден на серверах", ephemeral=True) elif isinstance(error.original, UnknownBackendResponse): - return await interaction.response.send_message("Ошибка на стороне сервера в исполнении говнокода, стоит подождать или позвать помощь", ephemeral=False) + return await interaction.followup.send("Ошибка на стороне сервера в исполнении говнокода, стоит подождать или позвать помощь", ephemeral=False) elif isinstance(error.original, discord.errors.NotFound): - return await interaction.response.send_message("Слишком долгий ответ со стороны сервера, причины:\n1) Возможно бекенд сдох\n2)Cлишком долгий незапланированный ответ с сервера\n3)Стоит позвать помощь", ephemeral=True) + return await interaction.followup.send("Слишком долгий ответ со стороны сервера, причины:\n1) Возможно бекенд сдох\n2)Cлишком долгий незапланированный ответ с сервера\n3)Стоит позвать помощь", ephemeral=True) traceback.print_exc() + return await interaction.followup.send("Возникла необратимая ошибка, хз что случилось. Попробуй еще раз!", ephemeral=True) async def GetSteam64OfDiscord(self, user, no_cache = False): if user.id in self.discord2steam_cache and not no_cache: diff --git a/user_ext/nyk.py b/user_ext/nyk.py index 62bd4a4..d1dd7f5 100644 --- a/user_ext/nyk.py +++ b/user_ext/nyk.py @@ -6,4 +6,5 @@ class Extension: async def nyk( interaction: discord.Interaction ): - return await interaction.response.send_message(f'среньк', ephemeral=False) \ No newline at end of file + await interaction.response.defer(thinking=True) + return await interaction.followup.send(f'среньк', ephemeral=False) \ No newline at end of file diff --git a/user_ext/powered.py b/user_ext/powered.py index ef82a48..0daa7d7 100644 --- a/user_ext/powered.py +++ b/user_ext/powered.py @@ -6,7 +6,8 @@ class Extension: async def powered( interaction: discord.Interaction ): - return await interaction.response.send_message(f""" + await interaction.response.defer(thinking=True) + return await interaction.followup.send(f""" Крутой бот на '/ API' для взаимодействие с сервисами фактов13! Создан на основе: https://github.com/Rapptz/discord.py ({discord.__version__}) Исходник бота: https://git.pblr-nyk.pro/gsd/Facti13.Bot.Discord.V2 diff --git a/user_ext/profile.py b/user_ext/profile.py index 0cd913d..b31187f 100644 --- a/user_ext/profile.py +++ b/user_ext/profile.py @@ -8,7 +8,7 @@ class Extension: interaction: discord.Interaction, profile: str = "" ): - steam64 = await core.GetSteam64OfDiscord(interaction.user) await interaction.response.defer(thinking=True) + steam64 = await core.GetSteam64OfDiscord(interaction.user) player = await core.GetPlayer(profile, steam64) if profile else await core.GetPlayer(steam64, steam64) return await interaction.followup.send(embed=player.embed, ephemeral=False) \ No newline at end of file diff --git a/user_ext/report.py b/user_ext/report.py index ae7aa2a..b61cbf0 100644 --- a/user_ext/report.py +++ b/user_ext/report.py @@ -9,6 +9,7 @@ class Extension: profile: str, reason: str ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) player = await core.GetPlayer(profile, steam64, False) - return await interaction.response.send_message(f'{await player.report(reason)}', ephemeral=False) \ No newline at end of file + return await interaction.followup.send(f'{await player.report(reason)}', ephemeral=False) \ No newline at end of file diff --git a/user_ext/servers.py b/user_ext/servers.py index 32f857a..e524576 100644 --- a/user_ext/servers.py +++ b/user_ext/servers.py @@ -8,12 +8,13 @@ class Extension: interaction: discord.Interaction, server: str = "" ): + await interaction.response.defer(thinking=True) steam64 = await core.GetSteam64OfDiscord(interaction.user) embed = discord.Embed() if server: if not server in core.stats.get("servers", {}).keys(): - return await interaction.response.send_message(f"Сервер с таким индификатором не существует, введи существующий из предложенных:\n{' '.join(core.stats.get('servers', {}).keys())}", ephemeral=False) + return await interaction.followup.send(f"Сервер с таким индификатором не существует, введи существующий из предложенных:\n{' '.join(core.stats.get('servers', {}).keys())}", ephemeral=False) embed.add_field(name=core.stats['servers'][server]['name'], value=str_server(core.stats['servers'][server]), inline=False) else: servers = [server for server in core.stats["servers"].values() if server['status'] == True and server['player_count'] > 0] @@ -35,7 +36,7 @@ class Extension: for server in servers: embed.add_field(name = server["name"], value=str_server(server), inline=False) - return await interaction.response.send_message(embed=embed, ephemeral=False) + return await interaction.followup.send(embed=embed, ephemeral=False) def str_server(data):