You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
922 B
TypeScript
32 lines
922 B
TypeScript
import { SlashCommand, SlashCreator, CommandContext, CommandOptionType } from 'slash-create';
|
|
import { Client } from 'discord.js'
|
|
const valid = ['498992803532242945', '435206857276260353']
|
|
|
|
export default class PingCommand extends SlashCommand {
|
|
constructor(creator: SlashCreator) {
|
|
super(creator, {
|
|
name: 'andrewkuo',
|
|
description: 'give andrewkuo role',
|
|
options: [
|
|
{
|
|
name: 'who',
|
|
description: 'who',
|
|
type: CommandOptionType.USER,
|
|
required: true
|
|
}
|
|
]
|
|
})
|
|
}
|
|
|
|
async run(ctx: CommandContext) {
|
|
if (valid.indexOf(ctx.user.id) == -1) {
|
|
return 'no'
|
|
}
|
|
const cli = this.client as Client
|
|
const g = cli.guilds.cache.get(ctx.guildID)
|
|
const me = g.members.cache.get(ctx.options.who as string)
|
|
await me.roles.add('1148804439755460638', '/andrewkuo')
|
|
return `gave andrewkuo role to @${me.user.username}`
|
|
}
|
|
}
|