aqify.js v1.9.0-pre-1
Aqify.js
Aqify.js is an open-source utility package made for Discord bots, it has a lot of features and they are simplified at the maximum for everyone!
This package is not affiliated with Discord or/and discord.js.
Features
- 100% written in TypeScript.
- Full support for TypeScript and JavaScript.
- Simple to use & Beginner friendly.
- Open-source & free to use.
- No credits required while using it!
- Promise based.
Table of contents
Install
Before installing the package, please make sure that you have the following requirements below:
- discord.js v^14.11.0.
- Node.js v^16.9.0.
If you meet the requirements above, you can install the package safely with no problems:
npm install aqify.js
yarn add aqify.jsImport
Typescript:
import { } from 'aqify.js';JavaScript (CommonJS):
const { } = require('aqify.js');Quick start
The project overview:
Example bot
├─── dist
├─── src
│ ├─── commands
│ │ └─── ping.ts
│ └─── index.ts
├─── package.json
└─── tsconfig.jsonThis is a tsconfig.json example, you can use it for this quick start:
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"outDir": "dist",
},
"include": [
"src"
],
"exclude": [
"dist",
"node_modules"
]
}Discord bot client with handler:
// index.ts
import { Client } from 'discord.js';
import { CommandsHandler } from 'aqify.js';
const config = {
token: 'Your bot token',
id: 'Your bot ID'
};
const client = new Client({
intents: ['Guilds']
});
export const handler = new CommandsHandler<Client>('./dist/commands/');
client.on('ready', () => console.log('Logged in as: ' + client.user?.username));
handler.on('load', (command) => console.log('Loaded new command: ' + command.name));
const collection = handler.load();
handler.deploy();
client.login(config.token);Ping command:
// ping.ts
import { handler } from '../index';
export default new handler.command({
structure: {
name: 'ping',
description: 'Replies with Pong!',
type: 1,
options: []
},
run: async (client, interaction) => {
await interaction.reply({
content: 'Pong!'
});
}
});Listening and responding to the commands:
// index.ts
client.on('interactionCreate', (interaction) => {
if (!interaction.isChatInputCommand()) return;
const command = collection.get(interaction.commandName);
if (!command) return;
try {
command.run(client, interaction);
} catch (e) {
console.error(e);
};
});If you want to define custom options for the commands, create one using the interface keyword and use it as the second type parameter of the class CommandsHandler:
interface Options {
ownerOnly?: boolean,
cooldown?: number
};
new CommandsHandler<Client, Options>(...);Examples
Dropdown paginator
import { EmbedBuilder } from 'discord.js';
import { DropdownPaginatorBuilder, SendMethod } from 'aqify.js';
const paginator = new DropdownPaginatorBuilder(interaction, {
placeHolder: 'Make a selection',
time: 60000
});
paginator.addOptions(
{
component: {
label: 'Option 1',
description: 'Option 1 description'
},
message: {
content: 'This is the option 1 message!'
}
},
{
component: {
label: 'Option 2',
emoji: '✌'
},
message: {
content: 'This is the option 2 message!',
embeds: [
new EmbedBuilder()
.setDescription('Option 2 embed!')
]
}
}
);
paginator.send(SendMethod.Reply, {
home: {
content: 'Select something from the menu below!'
},
onNotAuthor: async (i) => {
await i.reply({ content: 'You are not the author of this interaction.' });
},
replyWithEphemeralMessageOnCollect: true
});Buttons paginator
import { ButtonStyle } from 'discord.js';
import { ButtonsPaginatorBuilder, ButtonPaginatorID, SendMethod } from 'aqify.js';
const paginator = new ButtonsPaginatorBuilder(interaction, { time: 60000 });
paginator.addButtons(
{
label: 'Previous',
id: ButtonPaginatorID.Previous,
type: ButtonStyle.Secondary
},
{
label: 'Next',
id: ButtonPaginatorID.Next,
type: ButtonStyle.Secondary
},
{
label: 'Delete',
id: ButtonPaginatorID.Delete,
type: ButtonStyle.Danger
}
);
paginator.addPages(
{ content: 'Page 1' },
{ content: 'Page 2' },
{ content: 'Page 3' },
{ content: 'Page 4' },
{ content: 'Page 5' }
);
paginator.send(SendMethod.Reply, {
onNotAuthor: async (i) => {
await i.reply({ content: 'You are not the author of this interaction.' });
},
disableButtonsOnLastAndFirstPage: true,
});Buttons confirm (Yes/No/Cancel)
import { ButtonBuilder, ButtonStyle } from 'discord.js';
import { ButtonsConfirmBuilder, ButtonConfirmID, SendMethod } from 'aqify.js';
const confirm = new ButtonsConfirmBuilder(interaction, {
on: {
yes: async (i) => {
await i.reply({ content: 'Accepted!' });
},
no: async (i) => {
await i.reply({ content: 'Denied!' });
}
},
time: 30000
});
confirm.send(SendMethod.Reply, {
home: {
content: 'Click on Yes or No below!'
},
onNotAuthor: async (i) => {
await i.reply({ content: 'You are not the author of this interaction.' });
},
disableButtonsOnEnd: true
});Activity manager
import { ActivityManager, ActivityGameId } from 'aqify.js';
const channel = interaction.guild.members.cache.get(interaction.user.id).voice.channelId;
const manager = new ActivityManager(client);
manager.create(ActivityGameId.WatchTogether, channel)
.then((invite) => {
console.log(`https://discord.com/invite/` + invite.code);
});
manager.delete('Invite code')
.then((guild) => {
console.log('Deleted the invite from ' + guild.name);
});Plugins
Note: It's recommended to use these plugins in the event
readyfrom the client.<client>.on('ready', () => { new Plugin(); });
new ModmailPlugin(client, {
guild: 'Your server ID',
parent: 'The mails category ID',
managerRoles: ['Staff role ID']
});
new TicketPlugin(client, {
guild: 'Your server ID',
parent: 'The tickets category ID',
managerRoles: ['Staff role ID']
}).createPanel('The panel channel ID');
new BoostDetectorPlugin(client)
.on('boostCreate', (u) => console.log(u.user.tag + ' has boosted the server!'))
.on('boostRemove', (u) => console.log(u.user.tag + ' has unboosted the server...'));
new SuggestionPlugin(client, 'Suggestion channel ID', {
message: {
content: (message) => `<@${message.author.id}>`,
embeds: (message) => [
new EmbedBuilder()
.setTitle('New suggestion!')
.setAuthor({
name: message.author.tag,
iconURL: message.author.displayAvatarURL()
})
.setDescription(message.content)
.setColor('Blurple')
]
}
});There are a lot of features that are not on this preview, check the documentation site to view them all: Click here!
License
GPL-3.0; General Public License v3.0.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago