Git Product home page Git Product logo

discord-mod-bot's Introduction

โ” About

Discord-Mod-Bot is a package that makes it easier to make a moderation discord bot, with easily functions to kick, ban, mute members etc. And last but not least.. Why are you still reading this?! Go for it and install it!

NPM info

๐Ÿ“Š Installation

Before installing:

  1. You need to have node.js installed
  2. You need the NPM package 'discord.js'

After you have/did this.. You can finally install the package!

Terminal Command:

$ npm install discord-mod-bot

โœ Usage

Currently available commands:

  • Kick - Kicks a member from the server
  • Ban - Bans a member from the server
  • Mute - Mutes a member from the server
  • Unmute - Unmutes a member from the server when he/she is muted
  • Lock - Locks a channel in the server.
  • Unlock - Unlocks a channel in the server when locked.
  • Slowmode - Updates the slowmode for a channel.

More coming soon..

kick

Kicks a member from the server.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
member The member to kick GuildMember 2
reason The reason why the member is kicked string 3
description The message of the embed string 4

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !kick do..
    if(message.content.startsWith('!kick')) {

        // Getting the member that is mentioned (has to be a GuildMember not a User)
        const member = message.mentions.members.first()

        // The reason of the mute
        const reason = 'Did something wrong!'

        // Running the kick command with the needed params
        // All {} to use with the description: {member.tag}, {member.username}, {member.id}, {member.mention}, {author.tag}, {author.username}, {author.id}, {author.mention}, {reason}
        command.kick(message, member, reason, '`{member.tag}` ({member.id}) was kicked by {author} with the reason {reason}')

    }

})

// Logging into the client
client.login('TOKEN')

ban

Bans a member from the server.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
member The member to kick GuildMember 2
reason The reason why the member is kicked string 3
days The total days of the ban integer 4
description The message of the embed string 5

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !kick do..
    if(message.content.startsWith('!ban')) {

        // Getting the member that is mentioned (has to be a GuildMember not a User)
        const member = message.mentions.members.first()

        // The reason of the mute
        const reason = 'Did something wrong!'

        // The total days of the ban
        const days = 7

        // Running the ban command with the needed params
        // All {} to use with the description: {member.tag}, {member.username}, {member.id}, {member.mention}, {author.tag}, {author.username}, {author.id}, {author.mention}, {reason}, {days}
        command.ban(message, member, reason, days, '`{member.tag}` ({member.id}) was banned by {author} with the reason {reason} for {days} days')

    }

})

// Logging into the client
client.login('TOKEN')

mute

Mutes a member from the server.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
member The member to mute GuildMember 2
role The mute role GuildRole 3
time The time of the mute string 4
reason The reason of the mute string 5
description The message of the embed string 6

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !mute do..
    if(message.content.startsWith('!mute')) {

        // Getting the member that is mentioned (has to be a GuildMember not a User)
        const member = message.mentions.members.first()

        // The role the user gets when muted
        const role = message.guild.roles.cache.find(role => role.name === 'muted')

        // The time of the mute, example: 10s / 15m / 2h / 1d
        const time = '10s'
        // If no time 
        const time = null || false

        // The reason of the mute
        const reason = 'Did something wrong!'

        // Running the mute command with the needed params
        // All {} to use with the description: {member.tag}, {member.username}, {member.id}, {author.tag}, {author.username}, {author.id}, {author.mention}, {reason}, {time}, {role.name},{role.id}, {role.mention}
        command.mute(message, member, role, time, reason, '`{member.tag}` ({member.id}) has been muted by {author} with the reason {reason} for {time} with the role {role.name} | {role.id}')

    }

})

// Logging into the client
client.login('TOKEN')

unmute

Unmutes a member from the server when he/she is muted.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
member The member to unmute GuildMember 2
role The mute role GuildRole 3
reason The reason of the mute string 4
description The message of the embed string 5

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !unmute do..
    if(message.content.startsWith('!unmute')) {

        // Getting the member that is mentioned (has to be a GuildMember not a User)
        const member = message.mentions.members.first()

        // The mute role of the server
        const role = message.guild.roles.cache.find(role => role.name === 'muted')

        // The reason of the unmute
        const reason = 'Did something wrong!'

        // Running the unmute command with the needed params
        // All {} to use with the description: {member.tag}, {member.username}, {member.id}, {member.mention}, {author.tag}, {author.username}, {author.id}, {author.mention}, {reason}, {role.name}, {role.id}, {role.mention}
        command.unmute(message, member, role, reason, '`{member.tag}` ({member.id}) has been unmuted by {author} with the reason {reason} with the role {role.name} | {role.id}')

    }

})

// Logging into the client
client.login('TOKEN')

lock

Locks a channel in the server.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
channel The channel to lock GuildChannel 2
reason The reason why the channel is locked string 3
description The message of the embed string 4

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !lock do..
    if(message.content.startsWith('!lock')) {

        // Getting the channel that has to be locked
        const channel = message.mentions.channels.first() || message.channel

        // The reason of the lock
        const reason = 'A raid is happening!'

        // Running the lock command with the needed params
        // All {} to use with the description: {channel.name}, {channel.id}, {channel.mention}, {reason}, {author.tag}, {author.username}, {author.id}, {author.mention}
        command.lock(message, channel, reason, 'The channel {channel.name} ({channel.id}) has been locked by {author.tag} ({author.id}) with the reason {reason}')

    }

})

// Logging into the client
client.login('TOKEN')

unlock

Unlocks a channel in the server when locked.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
channel The channel to unlock GuildChannel 2
reason The reason why the channel is unlocked string 3
description The message of the embed string 4

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !unlock do..
    if(message.content.startsWith('!unlock')) {

        // Getting the channel that has to be unlocked
        const channel = message.mentions.channels.first() || message.channel

        // The reason of the unlock
        const reason = 'The raid is over!'

        // Running the unlock command with the needed params
        // All {} to use with the description: {channel.name}, {channel.id}, {channel.mention}, {reason}, {author.tag}, {author.username}, {author.id}, {author.mention}
        command.unlock(message, channel, reason, 'The channel {channel.name} ({channel.id}) has been unlocked by {author.tag} ({author.id}) with the reason {reason}')

    }

})

// Logging into the client
client.login('TOKEN')

slowmode

Updates the slowmode for a channel.

Parameters:

Parameter Description Type Position
message The param of your message event Object 1
channel The channel to change slowmode GuildChannel 2
time The amount of seconds of the slowmode Integer 3
reason The reason of the new slowmode string 4
description The message of the embed string 5

Example:

// Importing the client of the discord.js modules
const client = new (require('discord.js')).Client()

// Setting up the module with the settings
require('discord-mod-bot')(client)

// Requiring the commands of the module
const { command } = require('discord-mod-bot')

// Starting up the client
client.on('ready', async () => {
    console.log(`${client.user.tag} is online!`)
})

client.on('message', async message => {

    // When the message is !slowmode do..
    if(message.content.startsWith('!slowmode')) {

        // Getting the channel for the new slowmode
        const channel = message.mentions.channels.first() || message.channel

        // The new time of the slowmode, example: 10 = 10 seconds (NOTE: Maximum = 21600)
        const time = '10'

        // The reason of the slowmode
        const reason = 'To many spam of messages!'

        // Running the unlock command with the needed params
        // All {} to use with the description: {channel.name}, {channel.id}, {channel.mention}, {time}, {reason}, {author.tag}, {author.username}, {author.id}, {author.mention}
        command.slowmode(message, channel, time, reason, 'The slowmode of the channel {channel.name} ({channel.id}) has been updated to {time} seconds by {author.tag} ({author.id}) with the reason {reason}')

    }

})

// Logging into the client
client.login('TOKEN')

๐Ÿ’ป Developers

This package has been developed by:

Koenie06 and I am Intelligent

๐Ÿ“ฐ Links

Discord:

Koenie06#9999
I am Intelligent#0001

discord-mod-bot's People

Contributors

bintelligent avatar koenie06 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.