is there a way to disable reacting on personal messages?
Closed this issue · 1 comments
e0xify commented
like said in the title i want the bot not to react on private messages to avoid abuse and stuff.
is there a way to disable recieving private messages or ignore them and only use groups?
Thanks
Deleted user commented
In router.py, replace this:
@ProtocolEntityCallback("message")
def on_message(self, message):
"Executes on every received message"
self.toLower(message.ack()) # Auto ack
self.toLower(message.ack(True)) # Auto ack (double blue check symbol)
# Routing only text type messages, for now ignoring other types. (media, audio, location...)
if message.getType() == 'text':
self.route(message)
with this:
@ProtocolEntityCallback("message")
def on_message(self, message):
"Executes on every received message"
self.toLower(message.ack()) # Auto ack
self.toLower(message.ack(True)) # Auto ack (double blue check symbol)
# Routing only text type messages, for now ignoring other types. (media, audio, location...)
if message.getType() == 'text':
if not message.isGroupMessage():
import config
if not any(message.getFrom().replace("@s.whatsapp.net", "") in s for s in config.admins):
logging.info("%s is trying to run \"%s\" via private chat." % (message.getFrom().replace("@s.whatsapp.net", ""), message.getBody()))
return
self.route(message)