Crowd-Scale Games Directed by a Telegram Bot

At our university's IT summer camp for high school students in 2019, we decided to teach programming by having the participants build their own Telegram bots. To build excitement throughout the camp and also to demonstrate the possibilities of these bots, I developed a Telegram bot in advance that accompanied the students throughout the camp. This bot provided regular updates on camp activities through official-looking press releases, a digital version of the popular group game Assassin, and most importantly, a visual and collaborative code-breaking challenge. In the end, it sparked interesting group dynamics with both participants and organizers, and was even mentioned in a local newspaper covering the camp.

I implemented the bot using the python-telegram-bot package and an SQLite database in conjunction with the package SQLAlchemy to handle participant and organizer data. On top of this foundation, I implemented the three features of the bot:

Announcements and Custom Language

Before I started developing the bot, my fellow students and me brainstormed about what kind of persona the bot should have and decided on an overzealous PR person. With an ironic twist, we wanted the bot to speak the hip language of high school students, so the bot incorporated elements such as random #hashtags and the occasional use of Leetspeak. To let the bot use this language universally, I modified the methods of the telegram package to accept custom preprocessing methods using the strategy pattern, which also helped with other features of the bot. The custom language was thus just another "sending strategy" of the bot.

The bot also had the ability to generate official-looking press releases consisting of text and an accompanying image. Using HTML and CSS extracted from our university's homepage, the bot filled in the necessary information and used the Python package IMGKit to create screenshot images of the press releases. During the camp, we regularly send out such announcements, slightly exaggerated in tone to keep the PR persona in tact, and inform about new happenings or newly unlocked features of the bot.

Assassin Group Game

What better way to immerse participants in a real-world yet digital game than to incorporate a group "assassination" challenge? In the traditional assassin game, participants are assigned targets and must discreetly "eliminate" them by handing them an object without drawing attention. The bot facilitated this group game by automatically assigning victims to participants, allowing them to register successful "assassinations," and updating the next assassination target accordingly. To prevent cheating, the bot communicated directly with the victims to verify that they were indeed "assassinated" or not. I implemented the game by adding another table to the SQLite database and adding the necessary commands and interactivity to the bot.

When an assassination was successful, the bot sent real-time notifications to all participants. These notifications created a buzz of excitement among both the camp organizers and the participants, for example, when we organizers could see late at night that there was suddenly a surge of assassinations among the supposedly sleeping participants.

Visual and Collaborative Code Breaking Challenge

In the traditional code-breaking challenge or cipher challenge, participants are given unique codes and then tasked with deciphering the underlying algorithm. They must work together to uncover the patterns and crack the code, encouraging teamwork and analytical thinking. Leveraging the bot's capabilities, we added a visual and collaborative twist to this challenge: Periodically, the bot sent personalized Instagram-like screenshots to each participant, with images related to their respective cities and other different elements of the post. For example, the number of likes on a post was tied to the participant's zip code combined with the current time, and the post was "liked" (filled red heart) if the participant had not yet been „eliminated“ in the game mentioned above. Since these elements could vary even for the same participant, all students had to work together to figure out the system behind the generation.

The image in the post showed the city of the participant alphabetically before or after the current participant, with the sky portion dynamically replaced with weather images corresponding to the current weather in that city. To generate these images, I parsed Wikipedia pages related to the participants' cities and extracted licensed images that allowed reuse and modification. Using a sky detection repository from GitHub, I created sky masks for each image to replace the skies with weather images that reflected the actual current weather in each city. To get the current weather, I used the OpenWeather API. Finally, the bot created the full Instagram post again using the HTML and CSS extracted from the actual Instagram website and the Python package IMGKit.

At the end of the camp, the participants presented the correct algorithm behind the generation of the images. In a few cases, they got sidetracked by elements we had not even considered, in which case we helped them get back on track.

Conclusion

Developing and implementing this Telegram bot for the summer camp was a huge undertaking, but the rewards were immeasurable. The campers embraced the bot with enthusiasm, and the sense of joy and engagement it brought was palpable. As the camp wrapped up, I couldn't help but think about future enhancements to the bot. Ideas such as introducing complex participant tasks into the Assassin group game or expanding the code-breaking challenges kept popping into my head. However, I leave these challenge up to future camp organizers.