this is a rewrite of the bot in typescript. detritus is used as a discord library instead of discord.js
This commit is contained in:
spiral 2022-10-21 17:22:01 +00:00
parent 6688d4dcd8
commit 56091a6df7
No known key found for this signature in database
GPG key ID: 244A11E4B0BCF40E
33 changed files with 731 additions and 1116 deletions

25
command/avatar.ts Normal file
View file

@ -0,0 +1,25 @@
import { APIGuildMember, APIUser, GatewayMessageCreateDispatchData } from "discord-api-types/v10";
import { restClient } from "../bot";
import CommandCategory from "../model/command-category";
export default {
aliases: ['avatar', 'av'],
category: CommandCategory.FUN,
isAllowedForContext: (_: GatewayMessageCreateDispatchData) => true,
description: 'Displays the avatar of the specified member.',
process: async (message: GatewayMessageCreateDispatchData, args: string[]) => {
let user: APIUser;
if (message.mentions.length == 0)
user = message.author;
else if (message.mentions.length > 1)
return restClient.createMessage(message.channel_id, `<@${message.author.id}>, there are too many mentions in this message! `
+`please pick only one user whose avatar you want to show.`);
else user = message.mentions[0];
const url = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=2048`;
await restClient.createMessage(message.channel_id, { embed: { image: { url } } });
}
}