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[] embeds?: Embed[]
tts?: boolean tts?: boolean
flags?: number flags?: number
temp?: boolean
} }
export class Interaction { export class Interaction {
@ -68,7 +69,7 @@ export class Interaction {
content: data.content ?? '', content: data.content ?? '',
embeds: data.embeds, embeds: data.embeds,
tts: data.tts ?? false, tts: data.tts ?? false,
flags: data.flags ?? undefined flags: data.temp === true ? 64 : data.flags ?? undefined
} }
: undefined : undefined
} }

View file

@ -18,7 +18,10 @@ export class MyClient extends Client {
@slash() @slash()
async eval(d: Interaction): Promise<void> { async eval(d: Interaction): Promise<void> {
if (d.user.id !== '422957901716652033') { if (
d.user.id !== '422957901716652033' &&
d.user.id !== '682849186227552266'
) {
d.respond({ d.respond({
content: 'This command can only be used by owner!' 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() const client = new MyClient()