alex-kopylov / secret-hitler-telegram-bot-statistic-collector Goto Github PK
View Code? Open in Web Editor NEWTelegram Bot for collecting Secret Hitler boardgame statistic
Telegram Bot for collecting Secret Hitler boardgame statistic
Add the Secret Hitler Statistics Bot to your Telegram group chat
this
SELECT r.game_id,
p.username,
CASE
WHEN r.role IN ('HC', 'DH', 'HL', 'HW') THEN 'Hitler'
WHEN r.role IN ('LW', 'LL') THEN 'Liberal'
WHEN r.role IN ('FW', 'FL') THEN 'Fascist'
END AS role
FROM records r
INNER JOIN players p ON r.player_id = p.id
WHERE r.game_id IN (
SELECT game_id
FROM records
GROUP BY game_id
HAVING SUM(CASE WHEN role IN ('HC', 'DH', 'HL', 'HW') THEN 1 ELSE 0 END) > 1
OR SUM(CASE WHEN role IN ('LW', 'LL') THEN 1 ELSE 0 END) > 6
OR SUM(CASE WHEN role IN ('FW', 'FL', 'HC', 'DH', 'HL', 'HW') THEN 1 ELSE 0 END) > 4
)
ORDER BY r.game_id;
This query selects games with invalid player distributions and displays the game ID, the usernames of the players involved, and their roles in a more human-readable format.
2. Games with Mutually Exclusive Victory Conditions with Usernames
SELECT DISTINCT r.game_id, p.username,
CASE
WHEN r.role IN ('LW', 'DH', 'FL', 'HL') THEN 'Liberal Win Condition'
WHEN r.role IN ('FW', 'HW', 'HC', 'LL') THEN 'Fascist Win Condition'
END AS win_condition
FROM records r
INNER JOIN players p ON r.player_id = p.id
WHERE r.game_id IN (
SELECT game_id FROM records WHERE role IN ('LW', 'DH', 'FL', 'HL')
INTERSECT
SELECT game_id FROM records WHERE role IN ('FW', 'HW', 'HC', 'LL')
)
ORDER BY r.game_id;
This query identifies games where there are winners from both the Liberal and Fascist sides, which should not be possible according to the rules. It lists the game ID, the usernames of the players involved, and the type of win condition they contributed to (Liberal or Fascist).
Люди путаются из-за слова last
The updated `save` function includes a comprehensive approach to processing and saving game records, as well as handling additional post-game tasks such as deleting messages and sending a photo with game results. This enhances the game's interactivity and user engagement. However, ensure that error handling is in place for each asynchronous operation within `asyncio.gather` to gracefully handle any failures.
Consider adding try-except blocks around operations that might fail, such as save_record
, save_game
, and context.bot.send_photo
, to ensure the application remains robust and user-friendly even when unexpected errors occur.
Originally posted by @coderabbitai[bot] in #10 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.