Projects - Elementle Twitter Bot

Elementle Twitter Bot



Python Tweepy



How it works

This project was made last month but I forgot to post it here. It's made with python and the tweepy library to post the mystery element and guess distribution of the previous day for my other project, Elementle. This task is scheduled so that it's posted when everyone on Earth enters the new day relative to the people in the earliest timezone. The storage of the guess distribution is stored as JSON on flask backend hosted on PythonAnywhere so that the post bot can retrieve it with JS fetch. The backend also stores the past 80 mystery elements so that if one element were to repeat, it wouldn't be until at least 80 days since its last appearence, thus giving players a more enjoyable experience.

 

Here's a sample guess distribution. Each key is the date which contains the attempts mapped to the number of people that got the mystery element on each attempt. 9 represents fail.

{
  "20250118": {
    "1": 1,
    "2": 1,
    "3": 0,
    "4": 3,
    "5": 2,
    "6": 2,
    "7": 2,
    "8": 0,
    "9": 0
  },
  "20250119": {
    "1": 2,
    "2": 1,
    "3": 2,
    "4": 3,
    "5": 1,
    "6": 1,
    "7": 0,
    "8": 0,
    "9": 1
  },
  "20250120": {
    "1": 0,
    "2": 0,
    "3": 0,
    "4": 0,
    "5": 1,
    "6": 0,
    "7": 0,
    "8": 0,
    "9": 0
  }
}

 

Here's a sample of past elements:

{
  "20241218": {
    "atomicNumber": 85,
    "family": "Halogen",
    "hint": "Radioactive and extremely rare in nature.",
    "name": "Astatine",
    "symbol": "At"
  },
  "20241219": {
    "atomicNumber": 93,
    "family": "Actinide",
    "hint": "Synthetic radioactive element, used in nuclear research and fuel.",
    "name": "Neptunium",
    "symbol": "Np"
  }
}

 

Links