harmony/test/cmds/userinfo.ts
2021-04-04 11:22:47 +05:30

23 lines
714 B
TypeScript

import { Command, Member, CommandContext, Embed } from '../../mod.ts'
export default class UserinfoCommand extends Command {
name = 'userinfo'
guildOnly = true
aliases = ['u', 'user']
async execute(ctx: CommandContext): Promise<void> {
const member: Member = ctx.message.member as any
const roles = await member.roles.array()
const embed = new Embed()
.setTitle(`User Info`)
.setAuthor({ name: member.user.tag })
.addField('ID', member.id)
.addField('Roles', roles.map((r) => r.name).join(', '))
.addField(
'Permissions',
JSON.stringify(member.permissions.has('ADMINISTRATOR'))
)
.setColor(0xff00ff)
ctx.channel.send(embed)
}
}