feat(slash): add temp?: boolean

This commit is contained in:
DjDeveloperr 2020-12-10 16:12:03 +05:30
parent e1281736ec
commit bb662267cb
2 changed files with 31 additions and 2 deletions

View File

@ -18,6 +18,7 @@ export interface InteractionResponse {
embeds?: Embed[]
tts?: boolean
flags?: number
temp?: boolean
}
export class Interaction {
@ -68,7 +69,7 @@ export class Interaction {
content: data.content ?? '',
embeds: data.embeds,
tts: data.tts ?? false,
flags: data.flags ?? undefined
flags: data.temp === true ? 64 : data.flags ?? undefined
}
: undefined
}

View File

@ -18,7 +18,10 @@ export class MyClient extends Client {
@slash()
async eval(d: Interaction): Promise<void> {
if (d.user.id !== '422957901716652033') {
if (
d.user.id !== '422957901716652033' &&
d.user.id !== '682849186227552266'
) {
d.respond({
content: 'This command can only be used by owner!'
})
@ -62,6 +65,31 @@ export class MyClient extends Client {
]
})
}
@slash()
async kiss(d: Interaction): Promise<void> {
const id = d.data.options.find((e) => e.name === 'user')?.value as string
const user = (await client.users.get(id)) ?? (await client.users.fetch(id))
const url = await fetch('https://nekos.life/api/v2/img/kiss')
.then((r) => r.json())
.then((e) => e.url)
d.respond({
embeds: [
new Embed()
.setTitle(`${d.user.username} kissed ${user?.username}!`)
.setImage({ url })
.setColor(0x2f3136)
]
})
}
@slash('ping')
pingCmd(d: Interaction): void {
d.respond({
content: `Pong!`
})
}
}
const client = new MyClient()