Skip to content

A lightweight package that helps you create your Discord bots

Notifications You must be signed in to change notification settings

Aiden01/Discord-Context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Context

Build Status

A package that helps you create your Discord bots

Example

import { Client } from 'discord.js'
import Context from 'discord-context'
const bot = new Client()

bot.on('message', (message) => {
    // message = '!ban @username#4454 flood'
    const ctx = new Context(message)

    console.log(ctx.command) // ban
    console.log(ctx.args) // ["ban", "@username#3354"]
    console.log(ctx.message) // Discord.Message object
    console.log(ctx.mentions) // message.mentions
})

Using another separator and prefix

import { Client } from 'discord.js'
import Context from 'discord-context'
const bot = new Client()

bot.on('message', (message) => {
    // message = '//ban.@username#4454.flood'
    const ctx = new Context(message, {
        prefix: "//",
        separator: "."
    })

    console.log(ctx.command) // ban
    console.log(ctx.args) // ["ban", "@username#3354"]
    console.log(ctx.message) // Discord.Message object
    console.log(ctx.mentions) // message.mentions
})

Installation

$ npm i --save discord-context

About

A lightweight package that helps you create your Discord bots

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published