This example snippet shows how you can delay an action & post a typing Indicator. It also shows how to reply to someone without pinging them. Use "!type" command to get typing indicator
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let sleep = async (ms) => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
};
await lib.discord.channels['@0.3.0'].typing.create({
channel_id: `${context.params.event.channel_id}`,
});
await sleep(4000); //send message after 4 sec
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `I was typing a message!`,
allowed_mentions: {
replied_user: false,
},
message_reference: {
message_id: context.params.event.id,
},
});