From e2a406da43a330f7ba3571b3e0744b8a4704e0e8 Mon Sep 17 00:00:00 2001 From: Florian SYLVAIN Date: Sat, 6 Mar 2021 20:15:26 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20-=20Renamed=20args=20name?= =?UTF-8?q?=20in=20commands=20functions=20so=20the=20$help=20command=20mak?= =?UTF-8?q?e=20sense.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/cmd_lol.py | 8 ++++---- python/cmd_osu.py | 22 +++++++++++----------- python/cmd_other.py | 7 +++---- python/cmd_twitch.py | 8 ++++---- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/python/cmd_lol.py b/python/cmd_lol.py index 8a8bca2..bcb30ec 100644 --- a/python/cmd_lol.py +++ b/python/cmd_lol.py @@ -12,12 +12,12 @@ class LolCmds(commands.Cog): @commands.command() @commands.cooldown(1, 2, commands.BucketType.user) - async def lol_rank(self, ctx, arg, argf=None): - if argf is None: - player = what_player(arg) + async def lol_rank(self, ctx, invocator_name, x=None): + if x is None: + player = what_player(invocator_name) if player != 0: ranks = rank_track(player) - embed = discord.Embed(title=arg, url='https://bit.ly/3biTekM') + embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM') embed.set_thumbnail(url='http://ddragon.leagueoflegends.com/cdn/11.2.1/img/profileicon/' + str( player['profileIconId']) + '.png') embed.set_author(name='League Of Legend - Rank', url='https://euw.leagueoflegends.com/en-gb/', diff --git a/python/cmd_osu.py b/python/cmd_osu.py index d5f20e0..caa156c 100644 --- a/python/cmd_osu.py +++ b/python/cmd_osu.py @@ -9,13 +9,13 @@ class OsuCmds(commands.Cog): self.bot = bot @commands.command() - async def osu_profile(self, ctx, arg, argF=None): - if argF is None: - lst = await ask_osu_profile(arg) + async def osu_profile(self, ctx, username, x=None): + if x is None: + lst = await ask_osu_profile(username) if lst == 1: await ctx.send('The username you entered is unknown.') else: - embed = discord.Embed(title=arg, url='https://osu.ppy.sh/users/' + str(lst[0])) + embed = discord.Embed(title=username, url='https://osu.ppy.sh/users/' + str(lst[0])) embed.set_author(name='Osu! - Profile', url='https://osu.ppy.sh/home', icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png') embed.set_thumbnail(url='https://a.ppy.sh/' + str(lst[0])) @@ -37,9 +37,9 @@ class OsuCmds(commands.Cog): @commands.command() - async def osu_lastgame(self, ctx, arg, argF=None): - if argF is None: - lst = await ask_osu_last_game(arg) + async def osu_lastgame(self, ctx, username, x=None): + if x is None: + lst = await ask_osu_last_game(username) if lst == 1: await ctx.send('The player you entered is unknown or didn\'t played any game recently.') else: @@ -59,7 +59,7 @@ class OsuCmds(commands.Cog): value=str("%.2f" % (((lst[12]*300)+(lst[13]*100)+(lst[14]*50))/(sum(lst[12:16])*300)*100) + '%')) embed.add_field(name='100', value=str(lst[13])) embed.add_field(name='Katu', value=str(lst[16])) - embed.add_field(name='Player :', value=str(arg)) + embed.add_field(name='Player :', value=str(username)) embed.add_field(name='50', value=str(lst[14])) embed.add_field(name='Miss', value=str(lst[15])) embed.add_field(name='|', value='|') @@ -69,9 +69,9 @@ class OsuCmds(commands.Cog): @commands.command() - async def osu_acc(self, ctx, arg, argF=None): - if argF is None: - test_acc = await ask_osu_acc(arg) + async def osu_acc(self, ctx, username, x=None): + if x is None: + test_acc = await ask_osu_acc(username) if test_acc: embed = discord.Embed() embed.set_author(name='Osu! - Accuracy', icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png') diff --git a/python/cmd_other.py b/python/cmd_other.py index 07f4ea5..0dffd28 100644 --- a/python/cmd_other.py +++ b/python/cmd_other.py @@ -1,6 +1,5 @@ import discord import asyncio - from discord.ext import commands from discord.ext.commands.cooldowns import BucketType @@ -14,9 +13,9 @@ class OtherCmds(commands.Cog): @commands.command() @commands.cooldown(1, 2, commands.BucketType.guild) - async def issou(self, ctx, arg1: discord.User = None): - if arg1 is not None: - user = arg1 + async def issou(self, ctx, username: discord.User = None): + if username is not None: + user = username else: user = ctx.message.author try: diff --git a/python/cmd_twitch.py b/python/cmd_twitch.py index 40abcb7..fa94734 100644 --- a/python/cmd_twitch.py +++ b/python/cmd_twitch.py @@ -77,7 +77,7 @@ class TwitchCmds(commands.Cog): self.bot = bot @commands.command() - async def chat_set(self, ctx, arg1): + async def chat_set(self, ctx, channel_name): try: await ctx.message.delete() except discord.errors.Forbidden: @@ -86,10 +86,10 @@ class TwitchCmds(commands.Cog): if what_channel in list(chats): await ctx.send("```A chat is already active, you have to stop it before with the cmd $chat_stop !```") else: - if check_user(arg1): - obj = ChatObj(arg1, what_channel, self.bot) + if check_user(channel_name): + obj = ChatObj(channel_name, what_channel, self.bot) if obj.chat_init(): - await ctx.send(f'```Now connected to {arg1}\'s twitch channel !```') + await ctx.send(f'```Now connected to {channel_name}\'s twitch channel !```') obj.twitch.start() else: await ctx.send('```Something went wrong when trying to access Twitch IRC.```')