Releases: spuckhafte/breezer.js
Releases · spuckhafte/breezer.js
No API change
Custom Intents
Changes
- Define custom intents overriding the default provided by the library.
import { Bot } from 'breezer.js';
import { Intents } from 'discord.js';
const bot = new Bot({
token: "<TOKEN>",
commandsFolder: "commands",
prefix: "!",
lang: ".js",
// new
intents: [Intents.FLAGS.GUILDS]
});
Default intents:
[
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.MESSAGE_CONTENT,
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS
]
Generics
Changes
- Now you also have to define the type of your cmd structure as Generic to the command class. This well help in inferring the type of each field properly when using
this.extract()
.
// commands/test.ts
export default class extends Command<[string, number|null]> {
constructor() {
super({
structure: ["string", "number|null"]
});
}
async execute() {
// one: string, two: number|null
const [one, two] = this.extract();
}
}
Itty-Bitty Changes
Changes
(June 23 2023 -> September 09 2023)
Pre
Changes
hasPerm
method nd function to check if the bot or any user has certain perm in the channel linked to a cmd's msg.
Inside a Command class (checks only for the bot)
this.botHasPerm( perm: PermissionResolvable ): boolean
Anywhere (checks for any user)
import { userHasPerm } from 'breezer.js';
userHasPerm( perm, userId: string, msg: Message ): Promise<boolean>
Pre
Changes
- State operations are done inside angle brackets:
<< $count$ + 1 >>
hasPerm
function and method to check if a bot or any user has a specific permission. (check the latest :: 0.4.1 release note)
## hasPerm
functions
### Inside a command class (checks only for the bot):
- this.hasPermInGuild( perm: PermissionResolvable )
- this.hasPernInChannel( perm: PermissionResolvable )
### Anywhere (checks for any userId)
import { hasPermInGuild, hasPermInChannel } from 'breezer.js'
- hasPermInGuild( perm, msg, userId: optional )
- hasPermInChannel( perm, msg, userId: optional )
- if userId
is not specified msg-author's id is used.