harmony/test/cmds/userinfo.ts

24 lines
714 B
TypeScript
Raw Normal View History

2021-04-04 05:52:47 +00:00
import { Command, Member, CommandContext, Embed } from '../../mod.ts'
export default class UserinfoCommand extends Command {
2020-12-02 12:29:52 +00:00
name = 'userinfo'
guildOnly = true
aliases = ['u', 'user']
2020-12-02 12:29:52 +00:00
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)
}
}