Discord bot/ Mute

(btw i’m not experienced at all in this) Hey, i was just trying to make a discord bot for a server! If anyone could send a Code that mutes a user for a certain time? Btw i use Atom js if that’s important.
The only thing i have are the basics:

const Discord = require(‘discord.js’);
const client = new Discord.Client();

client.on(‘ready’, () => {
console.log(Logged in as ${client.user.tag}!);
});

client.on(‘message’, msg => {
if (msg.content === ‘$help’) {
msg.reply(‘jus chii out foo’);
}
});

client.login(‘spooky token’);

In the future i’d like to have a ban, mute/tempmute.
Thanks for anyone trying to help me!

Hey there, currently on mobile so i cannot type much code.
I guess you can experiment on setTimeout() or check the database every second. The best way i can say is using setTimeout.

How to use setTimeout

Hey,
Make a role with send messages permissison false
And try using member.roles.add('role_id').
For tempmute you also can use setTimeout().
Thanks

Hello again, thanks for the help guys but i legit have no clue where to put it, could you please make a copy and paste of it? I don’t know how to add different things to what the bot can do, like i said all i have is:
const Discord = require(‘discord.js’);

const client = new Discord.Client();

client.on(‘ready’, () => {
console.log(Logged in as ${client.user.tag}!);
});

client.on(‘message’, msg => {
if (msg.content === ‘$help’) {
msg.reply(‘jus chii out foo’);
}
});

client.login(’[token]’);

Like i don’t know if i can just put the new “mute” code under it? or if i have to put it in somewhere?Once again, thanks for trying to help me.
(also i use a mac if that helps)

Hey,

You seem to be a bit new to JavaScript. I 100% recommend that you take a look at the w3schools JavaScript and NodeJS couse, it will make creating a discord bot much easier.

https://www.w3schools.com/js/
https://www.w3schools.com/nodejs/

hi so i dont get it to make a certain person mute in a server in discord u have to code ur own thing?

Yep. That’s how discord bots work. People code the bots. There are YouTube videos and other online tutorials to help you out. Try searching for a tutorial on how to make a mute command in discord.js

Hope this helps :slight_smile:
Eddie
P.S. If you have any other questions, like why a specific piece of code isn’t working, I recommend making a new topic instead of bumping this old one

2 Likes