This bot is developed for registration users on Discord Server during PyCon TW conference.
In the direct message channel to RegBot, users can register themselves by sending !register <TOKEN>
.
User can use his/her own token to get the role he/she should get.
Name | Version |
---|---|
Python | 3.8 |
pipenv(Python module) | 2021.5.29 or up |
- Initialize environment variable
Copy
sample.env
to.env
cp sample.env .env
Then fill-in the environment variables value in .env
- Initialize Python environment
pipenv install --dev
- Enter the environment and start developing
pipenv shell
- Run bot and give it a try
python3 bot.py
SELECT
REPLACE(JSON_EXTRACT(ATTENDEE_INFO, '$.qrcode'), '"', '') AS token
FROM
`pycontw-225217.ods.ods_kktix_attendeeId_datetime`
WHERE
(REFUNDED IS NULL
OR REFUNDED = FALSE)
AND NAME LIKE '%<year>%' -- year param: 20xx of course
AND LOWER(NAME) LIKE '%<type>%'; -- type param: <corporate, individual>
format:
token,
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
SELECT
REPLACE(JSON_EXTRACT(ATTENDEE_INFO, '$.qrcode'), '"', '') AS token,
REPLACE(JSON_EXTRACT(ATTENDEE_INFO, '$.ticket_name'), '"', '') AS ticket_name
FROM
`pycontw-225217.ods.ods_kktix_attendeeId_datetime`
WHERE
(REFUNDED IS NULL
OR REFUNDED = FALSE)
AND NAME LIKE '%<year>%' -- year param: 20xx of course
AND LOWER(NAME) LIKE '%reserved%';
format:
token,ticket_name
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,Speaker 講者票(with Pyckage)
- Go to the prod server we deploy pycon-regbot
$ gcloud beta compute ssh --zone "asia-east1-b" "pycontw-website" --project "pycontw-225217"
- Change directory to
/home/jordan/pycon-regbot
, and you should put token files here.$ cd /home/jordan/pycon-regbot
Because ticket has different types, there are three different CSV files to represent each ticket type:
corporate.csv
for corporate ticketsindividual.csv
for individual ticketsreserved.csv
for reserved tickets
Each token is stored with the following format:
d41d8cd98f00b204e9800998ecf8427e,<ticket_type>
Redeemed tokens will be stored in used.csv
with the following format:
d41d8cd98f00b204e9800998ecf8427e
The log file is stored under .log
folder and saved as reg.log
.
!register <TOKEN>
: Register yourself with given token!help
: Shows the help message!help <COMMAND>
: Shows description of each command!hello <MESSAGE>
: Just say hello to bot.!howto
: Show instruction about how to register