Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
discord.js-casanova
Advanced tools
discord.js-casanova is a discord.js framework that sets up your bot as quickly as possible! all you have to do is write the commands and events! *There is a way to disable the command handler and event handler.*
NOTE: If you're using typescript with this package and having problems or have any questions please join the support server
- Reading files recursively from directories.
- Handle commands and events easily.
optional
.optional
.optional
| default=false
.optional
.nsfw | ownerOnly | guildOnly | disabled
.Note: command is the used command. message: is the Message object.
missing
are the missing permissions and type
is either client or member. // First we import the Client from discord.js-casanova.
const { CasanovaClient } = require("discord.js-casanova");
// Then we create our client!
class Client extends CasanovaClient {
// constructor
constructor() {
// super call
super({
// here are the Casanova Client options.
token: "Your bot token here.",
handlers: ["command", "event"], // this option just enables the command and event handlers if you want to use only the command handler you can just put command in the array.
owners: [""] // The owner IDS NOTE: Required if you want to use the ownerOnly command option.
}, {
// Here goes your regular discord.js client options
})
}
// This is a function to log the bot in.
async start() {
try {
await this.build();
return console.log(`${this.user.tag} is online!`);
} catch (e) {
console.error(e);
}
}
}
// Now that we've created our client let's log the bot in!
const client = new Client();
client.start();
// Now you're bot is online!
Well now that we've created our client let's set up the command handler.
// First let's import The command handler from discord.js-casanova!
const { CasanovaClient, CommandHandler } = require("discord.js-casanova");
class Client extends CasanovaClient {
constructor() {
super(
{
token: "Your bot token here.",
handlers: ["command", "event"],
owners: [""],
},
{}
);
// Then inside the clients constructor create a property and name it whatever you want in this example I'm naming it "commandHandler".
this.commandHandler = new CommandHandler(this, {
commandDirectory:
"The command folder directory the base being the main directory.",
prefix: (message) => {
return "+"; // Notice this function MUST return a string!
}, // here is your prefix note this can be a string, array, or a function
baseClientPermissions: ["Base client permissions."],
baseMemberPermissions: ["Base member permissions."],
blockBots: true, // Whether or not to block bots.
blockClient: true, // Whether or not to block the client.
defaultCooldown: 3, // The default cooldown for commands.
ignoreCooldown: [""], // Array of people who can ignore the cooldown.
setCommandClient: true, // default to true || This is mostly for typescript users if you set this to false you won't be able to access the client via `this.client`!
strict: true, // default to false. Whether to be strict about the command's execution.
}, {}); // second paramater is "ops" it's an object that allows you to add whatever you want.
}
async start() {
try {
await this.build();
return console.log(`${this.user.tag} is online!`);
} catch (e) {
console.error(e);
}
}
}
// Now for the event handler we have to import it first!
const {
CasanovaClient,
CommandHandler,
EventHandler,
} = require("discord.js-casanova");
class Client extends CasanovaClient {
constructor() {
super(
{
token: "Your bot token here.",
handlers: ["command", "event"],
owners: [""],
},
{}
);
this.commandHandler = new CommandHandler(this, {
commandDirectory:
"The command folder directory the base being the main directory.",
prefix: (message) => {
return "+";
},
baseClientPermissions: ["Base client permissions."],
baseMemberPermissions: ["Base member permissions."],
blockBots: true,
blockClient: true,
defaultCooldown: 3,
ignoreCooldown: [""],
setCommandClient: true,
strict: true,
}, {});
// Then we make a property again call it whatever you want but i'm calling it eventHandler for this example.
this.eventHandler = new EventHandler(this, {
eventDirectory:
"The event folder directory the base being the main directory.",
}, {}); // second paramater is "opts" it's an object that allows you to add whatever you want.
}
async start() {
try {
await this.build();
return console.log(`${this.user.tag} is online!`);
} catch (e) {
console.error(e);
}
}
}
Notice: This should be in each file in the commands directory.
// Now for your first command!
// first we've gotta import the command base!
const { CommandBase } = require("discord.js-casanova");
module.exports = class PingCommand extends CommandBase {
constructor() {
super({
name: "ping", // the name of the command.
aliases: ["p"], // The aliases for the command <optional>.
category: "Utils", // Category. <optional>
clientPermissions: ["client permissions"], // <optional>
cooldown: 4, // 0 for no cooldown <>.
description: "description", // <optional>
guildOnly: true, // <optional> default=true
memberPermissions: ["member permissions"], // <optional>
nsfw: false, // <optional> default=false
ownerOnly: false, // <optional> default=false
usage: "usage", // <optional>
}, {}); // second paramater is "opts" it's an object that allows you to add whatever you want.
}
// Now every command Has to have an execute function.
execute(message, args) {
console.log(args);
console.log(message.content);
console.log(this.client.user.tag); // `this.client` being your client.
}
};
Notice: This should be in each file in the events directory.
// Now we gotta import the event base!
const { EventBase } = require("discord.js-casanova");
module.exports = class SomeEvent extends EventBase {
constructor() {
super({
name: "Name of the event.",
once: false, // <optional> Whether the event should be emitted once or not.
});
}
// Every event has to have an execute function.
execute(...parms) {
console.log(this.client.user.tag);
}
};
If you ever run into any issue with this package please join our support server and feel free to ping me!
Pull requests are welcome by anybody.
bugs and reports can go in the issues section or in the support server.
FAQs
discord.js-casanova is a discord.js framework that sets up your bot as quickly as possible! all you have to do is write the commands and events! *There is a way to disable the command handler and event handler.*
We found that discord.js-casanova demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.