Discord-Rose
The simple Discord library for advanced users.
Installation
Run npm i --save discord-rose
Links
Wiki Docs
Support Server
NPM , GitHub
Simple bot
You can easily use the SingleWorker
class for easy use of discord-rose, for scaled solution, look below
./index.js
const { SingleWorker } = require ( 'discord-rose' )
const worker = new SingleWorker ({
token: 'BOT TOKEN'
})
worker . commands
. prefix ( '!' )
. add ({
command: 'hello' ,
exec : ( ctx ) => {
ctx . reply ( 'World!' )
}
})
Scaled Bot
You can instead use a Master
& Worker
solution, one master managing multiple workers/clusters, which hold x amount of shards, making it much more efficient.
./master.js
const { Master } = require ( 'discord-rose' )
const path = require ( 'path' )
const master = new Master ( path . resolve ( __dirname , './worker.js' ), {
token: 'BOT TOKEN'
})
master . start ()
./worker.js
const { Worker } = require ( 'discord-rose' )
const worker = new Worker ()
worker . commands
. prefix ( '!' )
. add ({
command: 'hello' ,
exec : ( ctx ) => {
ctx . reply ( 'World!' )
}
})
Do node ./master.js
and you're off to the races. Scaled automatically.
Do note if your bot only ever fits into 1 cluster (< 5000 servers by default), you should consider using SingleWorker since master & worker introduce more process overhead
You can even easily implement slash commands directly within message commands.
Ready to take it to the next level? Take a look out our Wiki
Type aliases
CommandType
CommandType: string | RegExp
Emoji
Emoji: string | Snowflake
MessageTypes
Message
Types: RESTPostAPIChannelMessageJSONBody | RESTPostAPIWebhookWithTokenJSONBody | StringifiedMessageTypes | Embed < any >
Variables
Const PermissionsUtils
PermissionsUtils: { bits: { addReactions: number ; administrator: number ; auditLog: number ; ban: number ; connect: number ; createInvites: number ; createPrivateThreads: number ; createPublicThreads: number ; deafen: number ; embed: number ; emojis: number ; externalEmojis: number ; files: number ; kick: number ; manageChannels: number ; manageGuild: number ; manageMessages: number ; manageNicknames: number ; manageRoles: number ; manageThreads: number ; mentionEveryone: number ; move: number ; mute: number ; nickname: number ; prioritySpeaker: number ; readHistory: number ; requestToSpeak: number ; sendMessages: number ; sendMessagesInThreads: number ; speak: number ; stream: number ; tts: number ; useApplicationCommands: number ; useExternalStickers: number ; usePrivateThreads: number ; usePublicThreads: number ; useSlashCommands: number ; useVoiceActivity: number ; viewChannel: number ; viewInsights: number ; webhooks: number } ; calculate: any ; combine: any ; has: any ; hasPerms: any } = ...
Type declaration
bits: { addReactions: number ; administrator: number ; auditLog: number ; ban: number ; connect: number ; createInvites: number ; createPrivateThreads: number ; createPublicThreads: number ; deafen: number ; embed: number ; emojis: number ; externalEmojis: number ; files: number ; kick: number ; manageChannels: number ; manageGuild: number ; manageMessages: number ; manageNicknames: number ; manageRoles: number ; manageThreads: number ; mentionEveryone: number ; move: number ; mute: number ; nickname: number ; prioritySpeaker: number ; readHistory: number ; requestToSpeak: number ; sendMessages: number ; sendMessagesInThreads: number ; speak: number ; stream: number ; tts: number ; useApplicationCommands: number ; useExternalStickers: number ; usePrivateThreads: number ; usePublicThreads: number ; useSlashCommands: number ; useVoiceActivity: number ; viewChannel: number ; viewInsights: number ; webhooks: number }
addReactions: number
administrator: number
auditLog: number
ban: number
connect: number
createInvites: number
createPrivateThreads: number
createPublicThreads: number
deafen: number
embed: number
emojis: number
externalEmojis: number
files: number
kick: number
manageChannels: number
manageGuild: number
manageMessages: number
manageNicknames: number
manageRoles: number
manageThreads: number
mentionEveryone: number
move: number
mute: number
nickname: number
prioritySpeaker: number
readHistory: number
requestToSpeak: number
sendMessages: number
sendMessagesInThreads: number
speak: number
stream: number
tts: number
useApplicationCommands: number
useExternalStickers: number
usePrivateThreads: number
usePublicThreads: number
useSlashCommands: number
useVoiceActivity: number
viewChannel: number
viewInsights: number
webhooks: number
calculate: function
calculate( member: APIGuildMember , guild: CachedGuild , roleList: Collection < string , APIRole > , required: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads" ) : boolean
Parameters
member: APIGuildMember
roleList: Collection < string , APIRole >
required: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads"
Returns boolean
combine: function
combine( data: { guild: CachedGuild ; member: APIGuildMember ; overwrites?: APIOverwrite [] ; roleList?: Collection < string , APIRole > } ) : number
Parameters
data: { guild: CachedGuild ; member: APIGuildMember ; overwrites?: APIOverwrite [] ; roleList?: Collection < string , APIRole > }
member: APIGuildMember
Optional overwrites?: APIOverwrite []
Optional roleList?: Collection < string , APIRole >
Returns number
Full permission bit
has: function
has( bit: number | bigint , perm: "createInvites" | "kick" | "ban" | "administrator" | "manageChannels" | "manageGuild" | "addReactions" | "auditLog" | "prioritySpeaker" | "stream" | "viewChannel" | "sendMessages" | "tts" | "manageMessages" | "embed" | "files" | "readHistory" | "mentionEveryone" | "externalEmojis" | "viewInsights" | "connect" | "speak" | "mute" | "deafen" | "move" | "useVoiceActivity" | "nickname" | "manageNicknames" | "manageRoles" | "webhooks" | "emojis" | "useSlashCommands" | "useApplicationCommands" | "requestToSpeak" | "manageThreads" | "usePublicThreads" | "usePrivateThreads" | "createPublicThreads" | "createPrivateThreads" | "useExternalStickers" | "sendMessagesInThreads" ) : boolean
hasPerms: function
hasPerms( perms: number | bigint , bit: number | bigint ) : boolean
Legend
Constructor
Property
Method
Inherited constructor
Inherited property
Inherited method
Represents a guild cached in Worker#guilds. Does not contain
channels
,roles
,members
, orpresences
.