Make sure we only strip username if it the message contains it
This commit is contained in:
@ -140,7 +140,9 @@ export default class Bot extends EventEmitter {
|
||||
|
||||
update.forEach(res => {
|
||||
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
|
||||
const regex = new RegExp(`(/.*)@${this.info.username}`);
|
||||
text = text.replace(regex, '$1');
|
||||
|
Reference in New Issue
Block a user