- Telegram Bot: @uspqueuebot
The USP Queue Bot simulates a physical queue that is managed using simple commands. Users can join and leave the queue, while also keeping track of the queue length and their position in the queue. Admins can also manage the queue by removing or bumping the first user in the queue. The first few users in the queue would also be automatically informed as it is nearing their turn. Responses from the bot are also in Singlish to keep the vibe fun and local. Additionally, queue start and end timings can be added to signal the opening and closing of the queue. Users will only be unable to join and leave the queue before the start time, and after the end time. All other commands will still work.
Displays start message.
Displays help message with available commands.
Adds user into the queue.
Removes user from the queue.
Displays the user's position in the queue and the overall queue length.
These commands would only work if the user is an admin.
Displays the entire ordered queue by usernames.
Removes the first person in the queue when they have been served. The admin would be informed of the username of the user that is next in line. The next few users would also be notified of their progress in the line.
Bumps the first person in the queue by a few positions if they are late. The admin would be informed of the username of the user that is next in line. The next few users would also be notified of their progress in the line.
Purges the entire queue. Users in the queue will be notified of their removal from the queue.
Broadcasts a message to all users in the queue.
The following outlines the procedure for debugging.
- In uspqueuebot/credentials.py, ensure
ADMIN_CHAT_ID
is accurate on line 4. - In uspqueuebot/main.py, change
DEBUG_MODE
toTrue
on line 19. - In the command line, execute
severless deploy
or rundeploy.bat
. - From now on, all message metadata would be sent to the admin for debugging.
- Users who sends messages to the bot will also receive an "under maintenance" response.
- After debugging, change
DEBUG_MODE
in uspqueuebot/main.py back toTrue
. - In the command line, execute
severless deploy
again.
# Clone the repository into your local drive
# Open the command window in the bot file location
# Install the Serverless Framework
$ npm install serverless -g
# Install the necessary plugins
$ npm install
# Update AWS CLI in .aws/credentials
# Deploy it!
$ serverless deploy
# With the URL returned in the output, configure the Webhook
$ curl -X POST https://<your_url>.amazonaws.com/dev/set_webhook
- From the AWS Console, select AWS Lambda.
- In AWS Lambda, select "usp-queue-bot-dev-webhook".
- Select "Permissions" and select the Lambda role under "Execution role".
- In AWS IAM, select "Attach policies" under "Permissions" and "Permissions policies".
- Search for and select "AmazonDynamoDBFullAccess" and "Attach policy".
- Run the Telegram bot with
/start
and join the queue with/join
. - From the AWS Console, select AWS DynamoDB.
- Under "Tables", ensure that the "USPQueueBotTable" table has been created.