Fix group command

This commit is contained in:
Yasir Aris M 2024-09-27 21:12:39 +07:00 committed by GitHub
parent 173971aaa7
commit 56ee614b67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -280,22 +280,22 @@ async def play_game(client, message, game_mode):
# Kirim soal atau gambar berdasarkan mode # Kirim soal atau gambar berdasarkan mode
if mode_data["type"] == "image": if mode_data["type"] == "image":
image_url = result[mode_data["response_key"]] image_url = result[mode_data["response_key"]]
await message.reply_photo(photo=image_url, caption="Tebak gambar ini! Kamu punya 45 detik untuk menjawab. Kirim /next untuk lanjut ke soal berikutnya atau /stop untuk berhenti.") await message.reply_photo(photo=image_url, caption="Tebak gambar ini! Kamu punya 45 detik untuk menjawab. Kirim /next untuk lanjut ke soal berikutnya atau /stopgame untuk berhenti.")
else: else:
soal = result[mode_data["response_key"]] soal = result[mode_data["response_key"]]
await message.reply_text(f"{soal}\n\nKamu punya 45 detik untuk menjawab. Kirim /next untuk lanjut ke soal berikutnya atau /stop untuk berhenti.") await message.reply_text(f"{soal}\n\nKamu punya 45 detik untuk menjawab. Kirim /next untuk lanjut ke soal berikutnya atau /stopgame untuk berhenti.")
# Handle jawaban # Handle jawaban
while True: while True:
try: try:
response = await client.listen(chat_id=message.chat.id, filters=filters.text, timeout=45) response = await client.listen(chat_id=message.chat.id, filters=filters.text, timeout=45)
if response.text.lower() in ["/next", f"/next@{client.me.username}"]: if response.text.lower() in ["/next", f"/next@{client.me.username.lower()}"]:
await message.reply_text("Lanjut ke soal berikutnya!") await message.reply_text("Lanjut ke soal berikutnya!")
game_status[message.chat.id]['active'] = False game_status[message.chat.id]['active'] = False
return await play_game(client, message, game_mode) # Kirim soal berikutnya return await play_game(client, message, game_mode) # Kirim soal berikutnya
if response.text.lower() in ["/stop", f"/stop@{client.me.username}"]: if response.text.lower() in ["/stopgame", f"/stopgame@{client.me.username.lower()}"]:
await message.reply_text("Permainan dihentikan.") await message.reply_text("Permainan dihentikan.")
game_status[message.chat.id]['active'] = False game_status[message.chat.id]['active'] = False
break break