diff --git a/bot.py b/bot.py index fd7acbc..e4894cf 100644 --- a/bot.py +++ b/bot.py @@ -131,38 +131,38 @@ async def funfact(ctx): ran = randrange(len(jokes["funfacts"])) - msg = await ctx.send(f"Jednou jsem slyšela že: {jokes["funfacts"][ran]["txt"]}") + try: + await ctx.respond(f"Jednou jsem slyšela že: {jokes["funfacts"][ran]["txt"]}") + except: + await ctx.send(f"Jednou jsem slyšela že: {jokes["funfacts"][ran]["txt"]}") + + msg = await ctx.send(f"Co myslíš?") jokes["funfacts"][ran]["visited"] =+ 1 love = "" - change = 0 await msg.add_reaction("\U0001F44D") await msg.add_reaction("\U0001F44E") - await asyncio.sleep(60) + await asyncio.sleep(300) msg_cached = discord.utils.get(bot.cached_messages, id=msg.id) for emo in msg_cached.reactions: if emo.emoji == "👍": jokes["funfacts"][ran]["upvotes"]+= emo.count - 1 - change+= 1 elif emo.emoji == "👎": jokes["funfacts"][ran]["downvotes"]+= emo.count - 1 - change+= 1 elif emo.emoji == "🫀": - love = ', já Vás mám taky ráda 🫀' + love = ', já Vás mám taky ráda 🫀.' - if change != 0: - await ctx.send(f"Děkuju za ohodnoceni. {jokes["funfacts"][ran]["upvotes"]} říká že dobrý a {jokes["funfacts"][ran]["downvotes"]} že ne{love}. ") - else: - await ctx.send(f"Hlasovaní skončilo. Můžete zkusit další {love}.") + await msg.edit(content=f"Děkuju za ohodnoceni. {love}") + await msg.remove_reaction("\U0001F44D", msg.author) + await msg.remove_reaction("\U0001F44E", msg.author) with open("funfacts.json", "w") as f: json.dump(jokes, f) return True - bot.run("MTMyNTk1Mzg4OTcyNzQxNDM0Mw.G2Tgo0.2OhbgaVYhys0BhxJMVgGDnG0W5qvxH-soJML3M")