/
delete.ts
34 lines (27 loc) · 968 Bytes
/
delete.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Flags } from '@oclif/core'
import { chooseChannel } from '../../../../lib/commands/channels-util'
import { EdgeCommand } from '../../../../lib/edge-command'
import { chooseInvite } from '../invites'
export default class ChannelsInvitesDeleteCommand extends EdgeCommand<typeof ChannelsInvitesDeleteCommand.flags> {
static description = 'delete a channel invitation'
static flags = {
...EdgeCommand.flags,
channel: Flags.string({
char: 'C',
description: 'channel id',
helpValue: '<UUID>',
}),
}
static args = [{
name: 'id',
description: 'invitation UUID',
}]
async run(): Promise<void> {
const channelId = await chooseChannel(this,
'Which channel is the invite you want to delete for?',
this.flags.channel, { useConfigDefault: true })
const id = await chooseInvite(this, 'Choose an invitation to delete.', channelId, this.args.id)
await this.edgeClient.invites.delete(id)
this.log(`Invitation ${id} deleted.`)
}
}