mirror of
https://github.com/DarthKilroy/Spot.git
synced 2026-02-11 13:10:08 +00:00
rewrite
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:
parent
6688d4dcd8
commit
56091a6df7
33 changed files with 731 additions and 1116 deletions
25
command/avatar.ts
Normal file
25
command/avatar.ts
Normal 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 } } });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue