

The new channel is a clone, and retains all of the permissions and settings of the original. It is actually fully deleting the original channel, after creating a new one doing so, however, creates the illusion of the channel being cleared. Note that this is not actually "clearing" any messages or the channel. Clones the music channel, and sets its position to `pos` Gets the position of the music channel in the channel list Gets the `#music` channel, if it exists in the cache

Here's an untested example of how this might look in your code: setInterval(async function()

Here is a simple example of somewhat similar functionality from one of my bots it gets the channel, clones it, sets the clone's position in the channel list, and then deletes the original channel. Plus, this comes with the added bonus of increased organization and simplicity. Then, instead of sending -prune, your bot could simply clone and delete the #music channel at midnight, effectively clearing all Rythm commands. That solution has already been demonstrated by the other answer.Īnother way to go about this is to setup a specific channel solely for Rythm commands (like a #music text channel). One way to do this would be to loop through all of your channels, fetch as many messages sent by Rythm as possible, and bulk delete them. Instead of using Rythm's prune command, you simply need to execute the same functionality yourself. This is to prevent spam, avoid abuse, and prevent accidental misinterpretation of bots' messages as commands. All decently developed bots specifically check if the author of a message is a bot, and prevent processing the message if that is the case. I even did the unthinkable and set the scope to bot and permissions to admin on the Discord Developer site, so how do I go about getting my bot to prune the messages so I don't have to?Īs aforementioned, you generally cannot run other bots' commands using your own. When I type in -prune, it instantly works. Initialize bot by connecting to the serverĬurrently, it outputs the message -prune to each channel successfully, however, the rhythm bot/discord server seems to ignore the message as a command and instead, treats it as plain text. Event listener when a user connected to the server.Ĭonsole.log(`Logged in as $!`) Ĭ(function(el)Ĭ(el.id).send('-prune') The idea is to prune the Rhythm bot's message history without having to do it myself: // Run dotenv I've created a simple bot that sends a message to every text channel on my own server at if the time equals midnight.
