Repository navigation
v3.0 - Bot bithrday! 🎂
This is the first complete version of the TurketSteamBot!
Based on the library created in the v2.0, the first version of the TurketSteamBot was introduced!
Game prices search!
The bot can fetch a price of a game using either a Steam App ID, or an exact game name; e.g. if you want to fetch the price of Portal 2, you can either use its Steam App ID: 620, or Portal 2 with the first capital letter; portal 2 with the first lower letter won't work.
Compare prices!
There are four countries for which the prices are shown in the response: Europe, Turkey, Kazakhstan, and Russia.
Select from three options!
There are three possible ways to represent a price of a found game: in local currencies, e.g. tenge for Kazakhstan, rubles, or rubles with a commission. The commission is hardcoded: for euro, and tenge there are no commissions, but for the Turkish lira, it's 9.2% which is related to bank transfer commission in Turkey to an Oldubil card, and 17% for Russia, because there are losses in the currency conversion from tenge to UDS, and then to rubles using Kiwi.
AWS Lambda Hosting!
The bot has been successfully hosted in AWS Lambda in the Ireland region and is available in any time! New powershell scripts were introduced to build the bot, and form zip publish package!
JavaScript ES6 support
Because of AWS Lambda capability, the bot class has been rewritten to ES6 standart.
Steam API!
New steam API methods:
- Game info fetch. Fetched all available info about a game by Steam App ID
- All games fetch. The request is long, so it's cached. Steam App ID - Game Name pair
- Price classes to represent different prices of games: local, in-rubles, in-rubles with a commission
import { Price, Region } from './SteamApi.mjs'
const portal2Price = new Price(620, Region.Europe)
await portal2Price.getPrice()
console.log(portal2Price.formattedPrice())Bot class improvements!
Text handler, and any text hander
In the previous version, only one text handler existed. That handler caught all messages. In the current version, the hander was renamed to Any Text Hander, and Text Handet was introduced. It allows processing messages based on a text filter: the exact match is performed.
import { Bot } from './TelegramApi.mjs'
const bot = new Bot(token)
bot.registerCommandHandler('start', async (message) => {
await message.reply("This is /start!!!")
})
bot.textHandler('start', async (message) => {
await message.reply("This is 'start', but text!")
})
bot.registerAnyTextHandler(async (message) => {
await message.reply(`This is '${message.text}', which processed by Any Text Hander!`)
})Buttons support!
Reply keyboard markup support has been added into the Bot!
const localPricesButton = new KeyboardButton('🌍 Локальные цены', {oneTimeKeyboard: true})
const rublePricesButton = new KeyboardButton('🇷🇺 Цены в рублях', {oneTimeKeyboard: true})
const rublePricesWithPercentButton = new KeyboardButton('💸 Цены в рублях с комиссией', {oneTimeKeyboard: true})
const keyboard = [
[localPricesButton],
[rublePricesButton],
[rublePricesWithPercentButton],
]
const markup = new ReplyKeyboardMarkup(keyboard, {oneTimeKeyboard: true})
await message.reply('Какую стоимость игры ты хочешь увидить?', {reply_markup: markup.asJson()})Adding of Markdown V2 support
Now, the bot can process Markdown V2 messages
await message.reply(`Прайсы на ${nameAsLink}:\n${pricesString}`, { parseMode: ParseMode.MarkdownV2 })
