mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-24 22:46:41 +07:00
use regexp for /roll matching
This commit is contained in:
parent
b2c7728d06
commit
6d3f511807
1 changed files with 2 additions and 3 deletions
|
@ -86,9 +86,8 @@ const getRoute = async (
|
||||||
|
|
||||||
export const roll = async (text: string) => {
|
export const roll = async (text: string) => {
|
||||||
try {
|
try {
|
||||||
const parts = text.trim().split(" ");
|
const parts = text.match(/^\/roll\s?(\d+)?[-\s]?(\d+)?$/);
|
||||||
|
const result = await getRoute(parseVal(parts?.[1]), parseVal(parts?.[2]));
|
||||||
const result = await getRoute(parseVal(parts[1]), parseVal(parts[2]));
|
|
||||||
|
|
||||||
if (!result || !result?.id) {
|
if (!result || !result?.id) {
|
||||||
return say(failureMessages);
|
return say(failureMessages);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue