Untitled
db = SlashMongo("Weekly") status = server_var('contest_status') weekly_theme = server_var('contest_theme') contest_time = int(server_var('contest_time')) member = "**sera révélé à la fin**" if status != "post": set_error("❌ Des votes sont déjà en cours!") if fuzz.ratio(theme.lower(), weekly_theme.lower()) >= 60: set_error("❌ Ton thème ne doit pas être celui en cours!") cont = await db.find_one({"uid_db": str(user.id)}) or {} msg_id = cont.get("msgid_db", "") edit_count = cont.get("edit_count_db", -1) wins = cont.get("wins_db", 0) if edit_count >= 2: set_error("❌ Tu as atteint la limite de 2 éditions!") await db.update_one( {"uid_db": str(user.id)}, { "$set": { "theme_db": theme, "vote_db": 0, "voter_db": [str(user.id)], "edit_count_db": edit_count + 1, "wins_db": wins } }, upsert=True ) if contest_time == 0: await schedule_clock( custom_id="weekly_votes", time=get_time("after 5760 minutes"), metadata={} ) await schedule_clock( custom_id="weekly_winner", time=get_time("after 10080 minutes"), metadata={} ) update_server_var('contest_time', int(unix_timestamp)) timer = int(server_var('contest_time')) + 345572 vote = f"disponible <t:{timer}:R>" b = ComponentBuilder() b.add_button("Vote", "success", custom_id="like", emoji="🩷") b.add_button("Infos", "secondary", custom_id="informations", emoji="ℹ️") set_components(b) add_attachment(media) set_response_channel(1015259830824472719) set_response_message("Média posté 🩷") new_url = response.attachments[0].url await db.update_one( {"uid_db": str(user.id)}, {"$set": {"msgid_db": str(response.id), "img_db": new_url}}, upsert=True ) if msg_id: delete_message(1015259830824472719, int(msg_id))
Leave a Comment