mirror of
https://github.com/RYGhub/nameless.git
synced 2024-11-21 21:24:18 +00:00
Don't accept answers during the cooldown period in chapter 1
This commit is contained in:
parent
f895650cac
commit
c7decbd0f5
1 changed files with 10 additions and 2 deletions
12
main.py
12
main.py
|
@ -20,6 +20,8 @@ async def on_message(message):
|
||||||
# Add the user to the database
|
# Add the user to the database
|
||||||
session.add(user)
|
session.add(user)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
# Display when an user joins the game
|
||||||
|
print(f"{user} has joined Nameless!")
|
||||||
await user.message(nlessbot, "Welcome to Nameless!\nThere is no game here yet.\nOr maybe there is.")
|
await user.message(nlessbot, "Welcome to Nameless!\nThere is no game here yet.\nOr maybe there is.")
|
||||||
loop.create_task(call_every_x_seconds(advance_to_chapter_one, 10, user=user))
|
loop.create_task(call_every_x_seconds(advance_to_chapter_one, 10, user=user))
|
||||||
# If the user is playing the prologue, answer appropriately
|
# If the user is playing the prologue, answer appropriately
|
||||||
|
@ -34,10 +36,16 @@ async def on_message(message):
|
||||||
data = session.query(FirstChapter).filter_by(user_id=user.id).first()
|
data = session.query(FirstChapter).filter_by(user_id=user.id).first()
|
||||||
if data.current_question == 0:
|
if data.current_question == 0:
|
||||||
data.game_topic = message["text"]
|
data.game_topic = message["text"]
|
||||||
|
# Send the message
|
||||||
|
await user.message(nlessbot, "Hmmm. Interesting.")
|
||||||
|
# Don't accept answers during the cooldown period
|
||||||
|
data.current_question = -1
|
||||||
|
session.commit()
|
||||||
|
# Wait a bit before sending another message
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
# Start accepting answers
|
||||||
data.current_question = 1
|
data.current_question = 1
|
||||||
session.commit()
|
session.commit()
|
||||||
await user.message(nlessbot, "Hmmm. Interesting.")
|
|
||||||
await asyncio.sleep(5)
|
|
||||||
await user.message(nlessbot, "When do you think it will be released?")
|
await user.message(nlessbot, "When do you think it will be released?")
|
||||||
elif data.current_question == 1:
|
elif data.current_question == 1:
|
||||||
if "half" in message["text"].lower() and "life" in message["text"].lower():
|
if "half" in message["text"].lower() and "life" in message["text"].lower():
|
||||||
|
|
Loading…
Reference in a new issue