mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Merge branch 'avatar-command' of git://github.com/roflmaoqwerty/ZeppelinBot into roflmaoqwerty-avatar-command
This commit is contained in:
commit
f7cb29b15c
1 changed files with 25 additions and 0 deletions
|
@ -92,6 +92,7 @@ const ConfigSchema = t.type({
|
||||||
can_context: t.boolean,
|
can_context: t.boolean,
|
||||||
can_jumbo: t.boolean,
|
can_jumbo: t.boolean,
|
||||||
jumbo_size: t.Integer,
|
jumbo_size: t.Integer,
|
||||||
|
can_avatar: t.boolean,
|
||||||
});
|
});
|
||||||
type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||||
|
|
||||||
|
@ -157,6 +158,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
can_context: false,
|
can_context: false,
|
||||||
can_jumbo: false,
|
can_jumbo: false,
|
||||||
jumbo_size: 128,
|
jumbo_size: 128,
|
||||||
|
can_avatar: false,
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
@ -173,6 +175,7 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
can_help: true,
|
can_help: true,
|
||||||
can_context: true,
|
can_context: true,
|
||||||
can_jumbo: true,
|
can_jumbo: true,
|
||||||
|
can_avatar: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1537,6 +1540,28 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@d.command("avatar", "[user:resolvedUserLoose]", {
|
||||||
|
extra: {
|
||||||
|
info: <CommandInfo>{
|
||||||
|
description: "Retrieves a users profile picture",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@d.permission("can_avatar")
|
||||||
|
async avatarCmd(msg: Message, args: { user?: User | UnknownUser }) {
|
||||||
|
const user = args.user || msg.author;
|
||||||
|
if (!(user instanceof UnknownUser)) {
|
||||||
|
const avatarUrl = user.avatarURL.slice(0, user.avatarURL.lastIndexOf("."));
|
||||||
|
const embed: EmbedOptions = {
|
||||||
|
image: { url: avatarUrl + ".png?size=2048" },
|
||||||
|
};
|
||||||
|
embed.title = `Avatar of ${user.username}#${user.discriminator}:`;
|
||||||
|
msg.channel.createMessage({ embed });
|
||||||
|
} else {
|
||||||
|
this.sendErrorMessage(msg.channel, "Invalid user ID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async resizeBuffer(input: Buffer, width: number, height: number): Promise<Buffer> {
|
async resizeBuffer(input: Buffer, width: number, height: number): Promise<Buffer> {
|
||||||
return sharp(input, { density: 800 })
|
return sharp(input, { density: 800 })
|
||||||
.resize(width, height, {
|
.resize(width, height, {
|
||||||
|
|
Loading…
Add table
Reference in a new issue