From 5f80b587b4ac82d3be33f72ef819293f32905287 Mon Sep 17 00:00:00 2001 From: Andrew <62994051+Rarmash@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:42:22 +0300 Subject: [PATCH] Fortnite + Xbox fixes --- README.md | 2 +- gears/fortnite.py | 8 ++++---- gears/xbox.py | 3 +-- options.py | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a9bdfb3..d3eff28 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# R4Bot ![Version](https://img.shields.io/badge/Latest-1.1.3/master-blue.svg) +# R4Bot ![Version](https://img.shields.io/badge/Latest-1.1.4/master-blue.svg) Discord-бот, созданный для облегчения модерации серверов, и не только. Используются слэш-команды. ## 🛠️ Установка diff --git a/gears/fortnite.py b/gears/fortnite.py index 337e8c2..98c52cb 100644 --- a/gears/fortnite.py +++ b/gears/fortnite.py @@ -43,7 +43,7 @@ async def stats(self, ctx: discord.ApplicationContext, username=None): await ctx.defer() # Get the Fortnite username for the player - username = self.get_fortnite_username(ctx, username) + username = get_fortnite_username(ctx, username) # Check if the Fortnite username is available if not username: await ctx.respond( @@ -52,7 +52,7 @@ async def stats(self, ctx: discord.ApplicationContext, username=None): return # Make a request to the Fortnite API for the stats data - stats_data, status = self.fortnite_api_request(username) + stats_data, status = fortnite_api_request(username) # Handle different status codes if status == 403: @@ -94,7 +94,7 @@ async def stats(self, ctx: discord.ApplicationContext, username=None): try: embed.add_field(name="Владелец профиля", value=f"<@{search_record_id(str(ctx.guild.id), "Users", "fortnite", username)}>") - except TypeError: + except IndexError: pass await ctx.respond(embed=embed) except KeyError: @@ -128,7 +128,7 @@ async def connect(self, ctx: discord.ApplicationContext, username): await ctx.defer() author_id = str(ctx.author.id) - stats_data, status = self.fortnite_api_request(username) + stats_data, status = fortnite_api_request(username) if status != 200 or not stats_data: await ctx.respond(f"При добавлении возникла ошибка **{status}**.\nВозможно, вы неверно указали никнейм.") return diff --git a/gears/xbox.py b/gears/xbox.py index 9488c70..9712599 100644 --- a/gears/xbox.py +++ b/gears/xbox.py @@ -37,7 +37,6 @@ def __init__(self, bot): @xbox.command(description='Посмотреть статистику по пользователю') async def stats(self, ctx: discord.ApplicationContext, gamertag=None): - user_record = get_from_record(str(ctx.guild.id), "Users", str(ctx.author.id)) await ctx.defer() gamertag = get_xbox_gamertag(ctx, gamertag) if not gamertag: @@ -69,7 +68,7 @@ async def stats(self, ctx: discord.ApplicationContext, gamertag=None): value=f"[Тык](https://account.xbox.com/ru-ru/Profile?Gamertag={str(gamer_info.gamertag).replace(' ', '%20')})") try: embed.add_field(name="Владелец профиля", value=f"<@{search_record_id(str(ctx.guild.id), "Users", "xbox", gamertag)}>") - except TypeError: + except IndexError: pass if gamer_info.isXbox360Gamerpic: embed.set_thumbnail( diff --git a/options.py b/options.py index ecef4af..c1e626c 100644 --- a/options.py +++ b/options.py @@ -7,7 +7,7 @@ # Load environment variables from .env file load_dotenv() -version = "1.1.3" +version = "1.1.4" # Get environment variables token = environ.get('TOKEN')