reorganize
This commit is contained in:
parent
0aaee0e0f1
commit
d16bec1336
6 changed files with 67 additions and 48 deletions
|
@ -1,8 +1,10 @@
|
|||
import type { CacheType, CommandInteraction } from 'discord.js';
|
||||
import type { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
|
||||
import { COLORS } from '../constants';
|
||||
|
||||
export const membersCommand = async (i: CommandInteraction<CacheType>) => {
|
||||
export const membersCommand = async (
|
||||
i: ChatInputCommandInteraction<CacheType>
|
||||
) => {
|
||||
await i.deferReply();
|
||||
|
||||
const memes = await i.guild?.members.fetch().then((r) => r.toJSON());
|
||||
|
|
|
@ -15,14 +15,16 @@ export interface ModrinthProject {
|
|||
}
|
||||
|
||||
import {
|
||||
type CacheType,
|
||||
type CommandInteraction,
|
||||
EmbedBuilder,
|
||||
type CacheType,
|
||||
type ChatInputCommandInteraction,
|
||||
} from 'discord.js';
|
||||
|
||||
import { COLORS } from '../constants';
|
||||
|
||||
export const modrinthCommand = async (i: CommandInteraction<CacheType>) => {
|
||||
export const modrinthCommand = async (
|
||||
i: ChatInputCommandInteraction<CacheType>
|
||||
) => {
|
||||
await i.deferReply();
|
||||
|
||||
const { value: id } = i.options.get('id') ?? { value: null };
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import type { CacheType, CommandInteraction } from 'discord.js';
|
||||
import type { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { COLORS } from '../constants';
|
||||
|
||||
export const starsCommand = async (i: CommandInteraction<CacheType>) => {
|
||||
export const starsCommand = async (
|
||||
i: ChatInputCommandInteraction<CacheType>
|
||||
) => {
|
||||
await i.deferReply();
|
||||
|
||||
const count = await fetch('https://api.github.com/repos/PolyMC/PolyMC')
|
||||
|
|
36
src/commands/tags.ts
Normal file
36
src/commands/tags.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
import {
|
||||
type ChatInputCommandInteraction,
|
||||
type CacheType,
|
||||
EmbedBuilder,
|
||||
} from 'discord.js';
|
||||
import { getTags } from '../tagsTags';
|
||||
|
||||
export const tagsCommand = async (
|
||||
i: ChatInputCommandInteraction<CacheType>
|
||||
) => {
|
||||
const tags = await getTags();
|
||||
const tagName = i.options.getString('name', true);
|
||||
const tag = tags.find(
|
||||
(tag) => tag.name === tagName || tag.aliases?.includes(tagName)
|
||||
);
|
||||
|
||||
if (!tag) {
|
||||
await i.reply({
|
||||
content: `Tag \`${tagName}\` does not exist.`,
|
||||
ephemeral: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await i.reply({
|
||||
content: tag.text ? `**${tag.name}**\n\n` + tag.text : tag.text,
|
||||
embeds: tag.embed
|
||||
? [
|
||||
new EmbedBuilder(tag.embed).setFooter({
|
||||
text: `Requested by ${i.user.tag}`,
|
||||
iconURL: i.user.avatarURL() ?? undefined,
|
||||
}),
|
||||
]
|
||||
: [],
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue