Skip to content

Make a beep sound when a message containing a string is sent in a channel #29

Answered by rigwild
rigwild asked this question in Q&A
Discussion options

You must be logged in to vote
  • Beep when a msg include a string
  • Remember already seen messages to not re-beep
  • Add a reaction to found messages
  • Check last 100 messages every 15s
function beep() {
    const context = new AudioContext();
    const oscillator = context.createOscillator();
    oscillator.type = "sine";
    oscillator.frequency.value = 800;
    oscillator.connect(context.destination);
    oscillator.start();
    setTimeout(() => oscillator.stop(), 1200);
}

{
    id()
    const search = 'mange'
    const channelId = cid

    const seenMessagesIds = new Set()
    var loop = true
    while (loop) {
        const messages = await api.getMessages(cid, 100)
        const found = messages.filter(msg => msg.content.

Replies: 1 comment

Comment options

rigwild
Aug 8, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by rigwild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant