mirror of
https://github.com/Rainyy21/lol_discordbot
synced 2026-10-10 23:50:32 -04:00
fix some bug that doesn't let user to sign in and connect with discord, added some test
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
-3
@@ -11,9 +11,7 @@ class LoginCog(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@app_commands.command(name="login", description="Link your Riot account")
|
||||
@app_commands.describe(summoner="Your Riot ID (e.g. Name#TAG)")
|
||||
async def login(self, interaction: discord.Interaction, summoner: str):
|
||||
async def _handle_login(self, interaction: discord.Interaction, summoner: str):
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
if "#" not in summoner:
|
||||
@@ -53,6 +51,16 @@ class LoginCog(commands.Cog):
|
||||
ephemeral=True
|
||||
)
|
||||
|
||||
@app_commands.command(name="login", description="Link your Riot account")
|
||||
@app_commands.describe(summoner="Your Riot ID (e.g. Name#TAG)")
|
||||
async def login(self, interaction: discord.Interaction, summoner: str):
|
||||
await self._handle_login(interaction, summoner)
|
||||
|
||||
@app_commands.command(name="signin", description="Link your Riot account")
|
||||
@app_commands.describe(summoner="Your Riot ID (e.g. Name#TAG)")
|
||||
async def signin(self, interaction: discord.Interaction, summoner: str):
|
||||
await self._handle_login(interaction, summoner)
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(LoginCog(bot))
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
import aiohttp
|
||||
@@ -23,7 +24,7 @@ class ProfileCog(commands.Cog):
|
||||
#check if user login
|
||||
if not user:
|
||||
await interaction.followup.send(
|
||||
"❌ You haven't linked your Riot account yet. Use `/login` first."
|
||||
"❌ You haven't linked your Riot account yet. Use `/signin` first."
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class RecentCog(commands.Cog):
|
||||
#check if user
|
||||
if not user:
|
||||
await interaction.followup.send(
|
||||
"❌ You haven't linked your account yet. Use `/login` first."
|
||||
"❌ You haven't linked your account yet. Use `/signin` first."
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user