Commands use case - A7F/mtg-telegram-assistant GitHub Wiki
start
command: /start
pvt: if user is registered inside bot's database, it returns the user ID and a confirmation of successful registration; otherwise, if the user is not registered, it sends a reminder to start the bot inside a group in order to register the user correctly.
group: the bot stores user ID inside its database and sends a "welcome to the group" message. If the user already exists, the bot says the user was already stored. Each time a user sends /start, the bot also stores all the group administrators in the bot master array (see file config/config.json); that array is also cached for 15mins.
help
command: /help
pvt: the bot sends a short explanation of all the commands available. The bot can recognize if this command is sent from an admin, so if that's the case, the message also features 2 buttons below the message to swap between user and admin help commands.
group: this command is intended for pvt-only usage so it won't work inside your group.
dci
command: /dci your-dci-number
pvt: the bot sets your dci player number and saves it inside the database. If the user tries to insert an invalid dci number (which is, a non-numeric code) the bot replies that the command is wrong and reminds the usage; same thing happens if no dci number is specified after the command. In case of variations to the value previously inserted, just use this command again with the new number.
group: this command is intended for pvt-only usage so it won't work inside your group.
arena
command: /arena your-arena-nickname
pvt: the bot sets your MTG:Arena nickname and saves it inside the database. All nicknames are valid because the value is stored as string, so you can also specify your challenge id. If the user doesn't pass any value, the bot replies that the command is wrong and reminds the correct usage. In case of variations to the value previously inserted, just use this command again with the new nickname.
group: this command is intended for pvt-only usage so it won't work inside your group.
name
command: /name your-name
pvt: the bot sets your player name and saves it inside the database. This is the name the bot use to address the current player. All names are valid because the value is stored as string, so there are no bounds to the value (it can be numeric, alpha numeric, alpha only). If the user doesn't pass any value, the bot replies that the command is wrong and reminds the correct usage. In case of variations to the value previously inserted, just use this command again with the new name.
group: this command is intended for pvt-only usage so it won't work inside your group.
searching cards
command: [card name](/A7F/mtg-telegram-assistant/wiki/card-name)
pvt, group: search for one or up to four cards at once. Each card name must be between a pair of double-squared brackets. Once the search is done, the bot sends a reply to the original message for each card found. If no card with target name is found, the bot reminds it with a message. The bot performs a fuzzy search so it will find a card even if the name is incomplete. As instance, [emrakul, the aeons](/A7F/mtg-telegram-assistant/wiki/emrakul,-the-aeons) or [emrakul the eon torn](/A7F/mtg-telegram-assistant/wiki/emrakul-the-eon-torn) will both find emrakul, the aeons torn.
In the card picture description, the bot writes the average pricing (just to give the user a vague idea about how much his wallet will cry)for EU and US market, linking it to cardmarket or tcgplayer. It also appends all the formats in which the card is banned. However, notice that sometimes it may fail to build a proper link to those markets: in that case, it will embed the mainpage instead.
searching rulings for a card
command: ((card name))
pvt, group: search for one or up to four card rulings at once. Each card name must be between a pair of double-round brackets. Once the search is done, the bot sends a reply to the original message for each card ruling found. If no rulings for a card with target name is found, the bot reminds it with a message. Again, the bot performs a fuzzy search so it will find the card ruling even if the name is incomplete. As instance, ((emrakul, the aeons)) or ((emrakul the eon torn)) will both succeed in finding rulings for emrakul, the aeons torn.
An important note: as I said, this bot relies on Scryfall APIs; because I don't want to spam their service with requests, I decided it was reasonable to let each user make their own bot and put a limit on maximum cards searched at once to 4 but also to lower the delay between requests to 40ms (resulting in a faster search). This should be enough because they specifically ask to try limiting requests to a maximum of 10req/second and to place a small delay between each one. I hope you understand this tradeoff, I'm currently using this bot and I found it a fair compromise... however, you are free to edit the source code. Mind that if you don't respect their rate limits they might ip ban your bot.
friend list
command: /friendlist
pvt: this command is intended for group-only usage.
group: this command sends a list of all the users who set an arena nickname for their player card (see /arena command). If a user submits or modifies his/her arena player name, then you have to issue this command again if you want to see the changes as the bot needs to perform another query towards the internal database.
inline mode
Take a look here if you have no idea about inline bots. You can basically summon this bot from everywhere. This bot lets you send your player card to your friends (or to yourself if you have no friends, or to your LGS owner when he/she asks your dci number but you forgot your card at home for the 1000th time); a player card is built using all the values you previously set: name, arena nickname, dci number and even your telegram ID. Take into account that player cards are cached for 10 seconds it may take a while to generate a brand new player card (=10 seconds starting from the latest inline request you made). Obviously, users not registered to this bot won't get anything and values not set are displayed as blank.