diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08c0da03..1c39c1e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,5 +17,5 @@ jobs: - name: Lint run: | - npm ci + npm i npm run lint diff --git a/apps/api/src/bot/bot.controller.ts b/apps/api/src/bot/bot.controller.ts index 41e273a9..ab11c32f 100644 --- a/apps/api/src/bot/bot.controller.ts +++ b/apps/api/src/bot/bot.controller.ts @@ -41,6 +41,10 @@ export class BotController { this.service.commandGift(), this.service.commandSell(), this.service.commandBuy(), + this.service.commandHelp(), + this.service.commandHelpEn(), + this.service.commandDonate(), + this.service.commandDonateEn(), ]; } diff --git a/apps/api/src/bot/bot.service.ts b/apps/api/src/bot/bot.service.ts index 716c8aa4..86623143 100644 --- a/apps/api/src/bot/bot.service.ts +++ b/apps/api/src/bot/bot.service.ts @@ -1,4 +1,5 @@ import { createBotCommand } from "@twurple/easy-bot"; +import { DISCORD_SERVER_INVITE_URL, DONATE_URL } from "../config"; import { addStoneToVillage, addWoodToVillage, @@ -229,4 +230,50 @@ export class BotService { }, ); } + + public commandHelp() { + return createBotCommand( + "помощь", + async (_, { userId, userName, reply }) => { + await this.game.findOrCreatePlayer(userId, userName); + + void reply( + `${userName}, это интерактивная игра-чат, в которой может участвовать любой зритель! Пиши команды (примеры на экране) для управления своим героем. Вступай в наше комьюнити: ${DISCORD_SERVER_INVITE_URL}`, + ); + return; + }, + ); + } + + public commandHelpEn() { + return createBotCommand("help", async (_, { userId, userName, reply }) => { + await this.game.findOrCreatePlayer(userId, userName); + + void reply( + `${userName}, this is an interactive chat game that any viewer can participate in! Write commands (examples on the screen) to control your hero. Join our community: ${DISCORD_SERVER_INVITE_URL}`, + ); + return; + }); + } + + public commandDonate() { + return createBotCommand("донат", async (_, { userId, userName, reply }) => { + await this.game.findOrCreatePlayer(userId, userName); + + void reply(`${userName}, поддержи игру: ${DONATE_URL}`); + return; + }); + } + + public commandDonateEn() { + return createBotCommand( + "donate", + async (_, { userId, userName, reply }) => { + await this.game.findOrCreatePlayer(userId, userName); + + void reply(`${userName}, support the game: ${DONATE_URL}`); + return; + }, + ); + } } diff --git a/apps/api/src/config.ts b/apps/api/src/config.ts index 30a33802..0652768a 100644 --- a/apps/api/src/config.ts +++ b/apps/api/src/config.ts @@ -3,3 +3,6 @@ export const MAX_X = 1300; export const MIN_Y = 20; export const MAX_Y = 1200; + +export const DONATE_URL = "https://www.donationalerts.com/r/hmbanan666"; +export const DISCORD_SERVER_INVITE_URL = "https://discord.gg/B6etUajrGZ";