Tibot

Discord bot for MMORPG game Tibia

Posted by Kossanovic on February 26, 2023

Discord bot created around data from game Tibia.

On command "$Whois <nickname>" it returns data about a given player's character.

@client.event
async def on_message(message):
    if message.content.startswith('$Whois')

 Having its name, app was defining character's server and one of five possible main vocations.

class Character():

    def __init__(self, name):
        self.character = self.character(name)
        self.char_name = self.character.get("Name:")
        self.char_world = self.character.get("World:")
        self.char_voc = self.character.get("Vocation:")

With this information it was getting an information about highscores on server by parsing it from site and uploading it into json file if it haven't done it before. After that it was getting data from this file, such as characters rank among certain skills.

{
  "1": [
    {
      "Rank": "1",
      "Name": "Zmuts",
      "Vocation": "Master Sorcerer",
      "World": "Monza",
      "Level": "1408",
      "Skill": "1,254"
    },
    {
      "Rank": "2",
      "Name": "Lormora",
      "Vocation": "Master Sorcerer",
      "World": "Monza",
      "Level": "1606",
      "Skill": "1,250"
    }
  ]
}

To parse it needs to go through 18 categories which each contatins at least 1000 records.