Daricide
DIAdiscord.js - Imagine an app
•Created by Daricide on 11/6/2023 in #djs-questions
Does anyone have the starter code from the guide but in typescript?
I wrote my bot in javascript, and have now been trying to convert it to typescript. I don't feel like I have a firm grasp on all the typings and can't figure what is which type. I have been especially having trouble converting the event handling code.
13 replies
DIAdiscord.js - Imagine an app
•Created by Daricide on 10/23/2023 in #djs-questions
Way to not emit VoiceStateUpdate when bot is moving a user?
I am making a bot that will detect when a user is muted or deafened in a channel, and move them to a designated mute/deafen channel. I do this by using the voiceStateUpdate event and checking for the necessary conditions to be met. I also have it set up so that when the bot moves a user to the mute/deafen channel, it will take note of what channel that user was in, so that if the user unmutes/undeafens, the bot will be able to put them back in the channel they were in before. The issue I am having is that I guess technically when the bot moves a user, that action itself is a voiceStateUpdate, so it causes more voiceStateUpdates than there should be. For testing i was logging each time a voiceStateUpdate was detected, and when I deafen myself, the bot moves me to the deafen channel, but i see A LOT more voiceStateUpdates being logged. What can I do to minimize this or prevent it all together. Any help is appreciated. Thanks
5 replies