0.1.0-beta.11a • Published 3 years ago
pandawrapper v0.1.0-beta.11a
Welcome to PandaWrapper
, a Discord.JS wrapper in TypeScript.
Empty Bot
This will create a bot with a prefix
of eb?
. (ex: eb?ping
)
import { WrappedClient } from "pandawrapper";
const client = new WrappedClient("eb?");
// Remember to catch the error that may arise from a failed login.
client.login("token").catch(console.error.bind(console));
Ping MessageCommand
This will create a simple ping
message command. (ex: eb?ping
)
import { WrappedClient } from "pandawrapper";
const client = new WrappedClient("eb?");
// All commands are builders, so you can chain them on the same line.
const pingMessageCommand = new MessageCommand("ping").setCallback(async message => message.reply("Pong!"));
client.registerMessageCommand(pingMessageCommand);
// Remember to catch the error that may arise from a failed login.
client.login("token").catch(console.error.bind(console));
Managing MessagePermissions
of a MessageCommand
This will create and add permissions to the pre-existing ping
message command.
import { WrappedClient } from "pandawrapper";
const client = new WrappedClient("eb?");
// All commands are builders, so you can chain them on the same line.
const pingMessageCommand = new MessageCommand("ping").setCallback(async message => message.reply("Pong!"));
// When handling permissions, you can define them all in one go
const pingPermissions: MessagePermissions = {
allowed: new Set(["memberRoleId"]);
};
pingMessageCommand.setPermissions(pingPermissions);
// or separately.
pingMessageCommand.addDenied("someRoleIdThatCannotUsePing");
client.registerMessageCommand(pingMessageCommand);
// Remember to catch the error that may arise from a failed login.
client.login("token").catch(console.error.bind(console));
Basic SlashCommand
Example
This will create a SlashCommand
version of the ping
command. (ex: /ping
)
import { WrappedClient } from "pandawrapper";
const client = new WrappedClient("eb?");
// Remember: All commands are builders, so you can chain them on the same line.
const pingSlashCommand = new SlashCommand("ping", "Pong!")
.setCallback(async interaction => interaction.reply("Pong!"))
.setGlobal(false)
.setGuildId("yourGuildId")
.addPermission("memberRoleId", "ROLE", true);
client.registerCommandObject(pingSlashCommand);
// Remember to catch the error that may arise from a failed login.
client.login("token").catch(console.error.bind(console));
0.1.0-beta.12a
3 years ago
0.1.0-beta.12
3 years ago
0.1.0-beta.11a
3 years ago
0.1.0-beta.10a
3 years ago
0.1.0-beta.10
3 years ago
0.1.0-beta.9
3 years ago
0.1.0-beta.3
3 years ago
0.1.0-beta.2
3 years ago
0.1.0-beta.5
3 years ago
0.1.0-beta.4
3 years ago
0.1.0-beta.1
3 years ago
0.1.0-beta.7
3 years ago
0.1.0-beta.6
3 years ago
0.1.0-beta.8
3 years ago
0.0.11
3 years ago
0.0.10
3 years ago