Skip to content
Advertisement

How to delete message if it’s not starting with specified word. Discord.js

I want to know how to make function that deletes message if it’s not starting with specified “word” not when message includes the word specified but when it’s starting with it (everything on specified channel with channel id), it’s very important for me and I can’t find any solution online. I’ve tried nothing because I don’t know how to make it.

Advertisement

Answer

Welcome, you can listen to the “message” event and check if the message starts with the string of your need. Example for you here:

JavaScript

I hope this helped you, you can read more about the event listeners here.

Advertisement