Make sure we only strip username if it the message contains it
This commit is contained in:
parent
794ef80520
commit
ac625708f9
@ -140,7 +140,9 @@ export default class Bot extends EventEmitter {
|
|||||||
|
|
||||||
update.forEach(res => {
|
update.forEach(res => {
|
||||||
let text = res.message.text;
|
let text = res.message.text;
|
||||||
if (text.startsWith('/')) {
|
const selfUsername = `@${this.info.username}`;
|
||||||
|
|
||||||
|
if (text.startsWith('/') && text.indexOf(selfUsername) > -1) {
|
||||||
// Commands are sent in /command@thisusername format in groups
|
// Commands are sent in /command@thisusername format in groups
|
||||||
const regex = new RegExp(`(/.*)@${this.info.username}`);
|
const regex = new RegExp(`(/.*)@${this.info.username}`);
|
||||||
text = text.replace(regex, '$1');
|
text = text.replace(regex, '$1');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "telegram-api",
|
"name": "telegram-api",
|
||||||
"version": "0.4.61",
|
"version": "0.4.62",
|
||||||
"description": "Control Telegram bots easily using the new Telegram API",
|
"description": "Control Telegram bots easily using the new Telegram API",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user