Passage méthode en membre protégé 3
This commit is contained in:
parent
c99ce2eb46
commit
704b6eea36
1 changed files with 9 additions and 9 deletions
|
@ -75,7 +75,7 @@ class Commands(commands.Cog):
|
|||
await ctx.message.add_reaction(emoji = '✅')
|
||||
await ctx.send(content = None, embed = embed)
|
||||
@_calc.error
|
||||
async def calc_error(self, ctx, error):
|
||||
async def _calc_error(self, ctx, error):
|
||||
await ctx.send("Tu n'as pas spécifié de calcul.")
|
||||
|
||||
@commands.command(name='syntax', aliases = ['syntaxe'])
|
||||
|
@ -172,18 +172,18 @@ class Commands(commands.Cog):
|
|||
value = str(user[0].created_at.astimezone(timezone('Europe/Paris')))[:-13].replace('-', '/').split()
|
||||
embed.add_field(name = "Compte créé le", value = f"{value[0][8:]}/{value[0][5:-3]}/{value[0][:4]} à {value[1]}")
|
||||
|
||||
embed.add_field(name = "Âge du compte", value = self.age_layout(self.get_age(user[0].created_at)))
|
||||
embed.add_field(name = "Âge du compte", value = self._age_layout(self._get_age(user[0].created_at)))
|
||||
|
||||
embed.add_field(name = "Mention", value = user[0].mention)
|
||||
|
||||
value = str(user[0].joined_at.astimezone(timezone('Europe/Paris')))[:-13].replace('-', '/').split()
|
||||
embed.add_field(name = "Serveur rejoint le", value = f"{value[0][8:]}/{value[0][5:-3]}/{value[0][:4]} à {value[1]}")
|
||||
|
||||
embed.add_field(name = "Est sur le serveur depuis", value = self.age_layout(self.get_age(user[0].joined_at)))
|
||||
embed.add_field(name = "Est sur le serveur depuis", value = self._age_layout(self._get_age(user[0].joined_at)))
|
||||
await ctx.message.add_reaction(emoji = '✅')
|
||||
return await ctx.send(embed = embed)
|
||||
await ctx.send("Tu mentionnes trop d'utilisateurs : `.whois [@Membre]`")
|
||||
def get_age(self, date):
|
||||
def _get_age(self, date):
|
||||
joursRestants = datetime.now() - date
|
||||
years = joursRestants.total_seconds() / (365.242 * 24 * 3600)
|
||||
months = (years - int(years)) * 12
|
||||
|
@ -192,7 +192,7 @@ class Commands(commands.Cog):
|
|||
minutes = (hours - int(hours)) * 60
|
||||
seconds = (minutes - int(minutes)) * 60
|
||||
return (int(years), int(months), int(days), int(hours), int(minutes), int(seconds))
|
||||
def age_layout(self, tuple):
|
||||
def _age_layout(self, tuple):
|
||||
time = {}
|
||||
time[0], time[1], time[2], time[3], time[4], time[5] = "an", "mois", "jour", "heure", "minute", "seconde"
|
||||
for i in range(len(tuple)):
|
||||
|
@ -248,7 +248,7 @@ class Commands(commands.Cog):
|
|||
message = await ctx.send("Aucun salon vocal dans ce serveur, réagissez à ce message avec ✋ pour signaler votre présence (attention, je réagis aussi).")
|
||||
await message.add_reaction(emoji = "✋")
|
||||
@_appel.error
|
||||
async def appel_error(self, ctx, error):
|
||||
async def _appel_error(self, ctx, error):
|
||||
if isinstance(error, commands.CheckFailure):
|
||||
await ctx.send("Tu n'as pas la permission de faire cette commande, demande à un professeur.")
|
||||
else:
|
||||
|
@ -261,7 +261,7 @@ class Commands(commands.Cog):
|
|||
if len(args) > 2:
|
||||
question = args[0].replace("<@!", "").replace(">", "").replace("<@", "")
|
||||
for i in re.findall(r'\d+', question):
|
||||
ii = self.user_or_nick(ctx.author.guild.get_member(int(i)))
|
||||
ii = self._user_or_nick(ctx.author.guild.get_member(int(i)))
|
||||
try:
|
||||
question = question.replace(i, ii)
|
||||
except:
|
||||
|
@ -289,7 +289,7 @@ class Commands(commands.Cog):
|
|||
shuffle(emojis_chosen)
|
||||
for i in range(len(args[1:])):
|
||||
message += f"{emojis_chosen[i]} -> {propositions[i]}\n"
|
||||
embed = discord.Embed(title = question, description = message,color = randint(0, 0xFFFFFF)).set_footer(text = self.user_or_nick(ctx.author), icon_url = ctx.author.avatar_url)
|
||||
embed = discord.Embed(title = question, description = message,color = randint(0, 0xFFFFFF)).set_footer(text = self._user_or_nick(ctx.author), icon_url = ctx.author.avatar_url)
|
||||
sondage = await ctx.send(embed = embed)
|
||||
for i in range(len(args[1:])):
|
||||
await sondage.add_reaction(emoji = emojis_chosen[i])
|
||||
|
@ -298,7 +298,7 @@ class Commands(commands.Cog):
|
|||
return await ctx.send(f"Désolé, mais tu as mis trop de possibilités (maximum : 20)")
|
||||
else:
|
||||
return await ctx.send(f'Désolé, mais il manque des arguments : `.sondage "<Question>" "<Proposition1>" "<Proposition...>" "<Proposition20>"`')
|
||||
def user_or_nick(self, user):
|
||||
def _user_or_nick(self, user):
|
||||
if user.nick:
|
||||
return f"{user.nick} ({user.name}#{user.discriminator})"
|
||||
else:
|
||||
|
|
Reference in a new issue