feat: mute/unmute chats (#168)

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
Aliyss Snow
2020-05-24 06:10:26 +02:00
committed by GitHub
parent cca74ec8b9
commit 4beeab9b2c
3 changed files with 49 additions and 0 deletions

View File

@@ -169,6 +169,12 @@ client.on('message', async msg => {
} else if (msg.body === '!archive') {
const chat = await msg.getChat();
chat.archive();
} else if (msg.body === '!mute') {
const chat = await msg.getChat();
// mute the chat for 20 seconds
const unmuteDate = new Date();
unmuteDate.setSeconds(unmuteDate.getSeconds() + 20);
await chat.mute(unmuteDate);
} else if (msg.body === '!typing') {
const chat = await msg.getChat();
// simulates typing in the chat