upgrade to discord.js v14

This commit is contained in:
Ryan Cao 2022-07-26 21:53:40 +08:00
parent 35a64b4f25
commit 7c0b91e1be
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
12 changed files with 446 additions and 533 deletions

View file

@ -1,14 +1,15 @@
import { MessageEmbed } from 'discord.js';
import { EmbedBuilder } from 'discord.js';
import { commands } from '.';
import { Command } from '..';
import type { Command } from '..';
import { COLORS } from '../constants';
export const cmd: Command = {
name: 'help',
desc: 'Shows this menu.',
exec: async (e) => {
const embed = new MessageEmbed()
const embed = new EmbedBuilder()
.setTitle('Help Menu')
.setColor('DARK_GREEN');
.setColor(COLORS.green);
const comman = commands;
comman.sort((x, y) => {
@ -27,7 +28,7 @@ export const cmd: Command = {
if (cmd.examples && cmd.examples[0]) {
resp.push(`**Examples**: \n${cmd.examples.join('\n> ')}`);
}
embed.addField('!' + cmd.name, resp.join('\n'));
embed.addFields({ name: '!' + cmd.name, value: resp.join('\n') });
}
await e.reply({ embeds: [embed] });

View file

@ -1,4 +1,5 @@
import type { Command } from '../index';
import type { Command } from '..';
import { COLORS } from '../constants';
export const cmd: Command = {
name: 'members',
@ -20,7 +21,7 @@ export const cmd: Command = {
m.presence?.status === 'dnd'
).length
} online members`,
color: 'GOLD',
color: COLORS.blue,
},
],
});

View file

@ -1,4 +1,4 @@
import type { Command } from '../index';
import type { Command } from '..';
export const cmd: Command = {
name: 'ping',

View file

@ -1,3 +1,4 @@
import { COLORS } from '../constants';
import type { Command } from '../index';
export const cmd: Command = {
@ -12,7 +13,7 @@ export const cmd: Command = {
embeds: [
{
title: `${count} total stars!`,
color: 'GOLD',
color: COLORS.yellow,
},
],
});

View file

@ -1,11 +1,12 @@
import { MessageEmbed } from 'discord.js';
import { EmbedBuilder } from 'discord.js';
import { getTags, type Command } from '..';
import { COLORS } from '../constants';
export const cmd: Command = {
name: 'tags',
desc: 'Lists the tags available',
exec: async (e) => {
const em = new MessageEmbed().setTitle('tags').setColor('DARK_GREEN');
const em = new EmbedBuilder().setTitle('tags').setColor(COLORS.green);
const tags = await getTags();
@ -23,7 +24,7 @@ export const cmd: Command = {
text += '\n[embedded message]';
}
em.addField('?' + tag.name, text);
em.addFields({ name: '?' + tag.name, value: text });
}
await e.reply({ embeds: [em] });