the bot can hug on its own

This commit is contained in:
ddorn 2020-05-18 18:27:23 +02:00
parent f96b41cd21
commit 669f316766
1 changed files with 9 additions and 10 deletions

View File

@ -225,7 +225,7 @@ class MiscCog(Cog, name="Divers"):
else "J'en veux un autre ! :heart_eyes:", else "J'en veux un autre ! :heart_eyes:",
"Le·a pauvre, iel est tout·e rouge !" "Le·a pauvre, iel est tout·e rouge !"
if not bot_hug if not bot_hug
else "Un robot ne peut pas rougir, mais je crois que... :blush", else "Un robot ne peut pas rougir, mais je crois que... :blush:",
"Hihi, il gratte ton pull en laine ! :sheep:", "Hihi, il gratte ton pull en laine ! :sheep:",
] ]
@ -239,7 +239,7 @@ class MiscCog(Cog, name="Divers"):
if has_role(ctx.author, Role.PRETRESSE_CALINS): if has_role(ctx.author, Role.PRETRESSE_CALINS):
bonuses += [ bonuses += [
"C'est le plus beau calin du monde :smiling_face_with_3_hearts: :smiling_face_with_3_hearts:", "C'est le plus beau calin du monde :smiling_face_with_3_hearts: :smiling_face_with_3_hearts:",
f"{who.mention} est subjugué ! :smiling_face_with_3_hearts:", f"{who.mention} est subjugué·e ! :smiling_face_with_3_hearts:",
] ]
if who.id == DIEGO: if who.id == DIEGO:
@ -290,6 +290,11 @@ class MiscCog(Cog, name="Divers"):
await ctx.send(text) await ctx.send(text)
if bot_hug and random.random() > 0.9:
await asyncio.sleep(3.14159265358979323)
ctx.author = get(ctx.guild.members, id=self.bot.user.id)
await ctx.invoke(self.hug, "back")
async def hug_back(self, ctx: Context): async def hug_back(self, ctx: Context):
hugger = ctx.author.id hugger = ctx.author.id
@ -348,13 +353,13 @@ class MiscCog(Cog, name="Divers"):
f"{medals[3]} {self.name_for(ctx, id)} : {qte} :orange_heart:" f"{medals[3]} {self.name_for(ctx, id)} : {qte} :orange_heart:"
for id, qte in top[3:8] for id, qte in top[3:8]
) )
embed.add_field(name="Apprentis peluches", value=top4to7) embed.add_field(name="Apprenti peluche", value=top4to7)
top8to13 = "\n".join( top8to13 = "\n".join(
f"{medals[4]} {self.name_for(ctx, id)} : {qte} :yellow_heart:" f"{medals[4]} {self.name_for(ctx, id)} : {qte} :yellow_heart:"
for id, qte in top[8:13] for id, qte in top[8:13]
) )
embed.add_field(name="Pelotte de laine", value=top8to13) embed.add_field(name="Pelote de laine de canard", value=top8to13)
await ctx.send(embed=embed) await ctx.send(embed=embed)
def name_for(self, ctx, member_or_role_id): def name_for(self, ctx, member_or_role_id):
@ -366,12 +371,6 @@ class MiscCog(Cog, name="Divers"):
return name return name
def hugger_tot(self, hugger: int):
return sum(1 for h in self.hugs if h.hugger == hugger)
def hugged_tot(self, hugged: int):
return sum(1 for h in self.hugs if h.hugged == hugged)
def get_hugs(self): def get_hugs(self):
File.HUGS.touch() File.HUGS.touch()
lines = File.HUGS.read_text().strip().splitlines() lines = File.HUGS.read_text().strip().splitlines()