Skip to content

Commit

Permalink
feat: spell conversation;
Browse files Browse the repository at this point in the history
fix: dice render
  • Loading branch information
svifty7 committed Nov 29, 2023
1 parent dbc7810 commit f438690
Show file tree
Hide file tree
Showing 13 changed files with 1,599 additions and 662 deletions.
1,197 changes: 969 additions & 228 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,23 @@
"dice-roller-parser": "^0.1.8",
"dotenv": "^16.0.3",
"grammy": "^1.19.2",
"jsdom": "^23.0.0",
"lodash-es": "^4.17.21",
"string-strip-html": "^11.6.20"
"sanitize-html": "^2.11.0",
"turndown": "^7.1.2",
"turndown-plugin-gfm": "^1.0.2"
},
"devDependencies": {
"@grammyjs/hydrate": "^1.3.1",
"@grammyjs/types": "^3.3.0",
"@rushstack/eslint-patch": "^1.4.0",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.14",
"@types/jsdom": "^21.1.6",
"@types/lodash-es": "^4.17.9",
"@types/node": "^18.13.0",
"@types/sanitize-html": "^2.9.5",
"@types/turndown": "^5.0.4",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"eslint": "^8.31.0",
Expand Down
10 changes: 5 additions & 5 deletions src/commands/tools/dice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import type { IContext } from '../../types/telegram.js';
import type { Conversation } from '@grammyjs/conversations';

const COMMAND_NAME = 'dice';
const CANCEL_MSG = 'Закончить броски';

const { getUserMentionHtmlString, leaveScene } = useHelpers();
const { getRenderedMsg } = useDiceRoller();

const keyboard = new Keyboard()
.text('Закончить броски')
.text(CANCEL_MSG)
.row()
.text('d2')
.text('d4')
Expand Down Expand Up @@ -55,16 +56,15 @@ const handler = async (

if (ctx.hasCommand(helpCommand.command)) {
await helpReply(ctx);
await handler(conversation);

return false;
return handler(conversation);
}

const {
message: { text }
} = ctx;

if (text === 'Закончить броски') {
if (text === CANCEL_MSG) {
return false;
}

Expand All @@ -86,7 +86,7 @@ const handler = async (
return false;
}

await ctx.replyWithMarkdownV2(msg, {
await ctx.reply(msg, {
disable_notification: true,
reply_markup: {
keyboard
Expand Down
Loading

0 comments on commit f438690

Please sign in to comment.