mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
adds incognito mode, fixes /emoji
This commit is contained in:
parent
fbdf212151
commit
e61a604b7c
36 changed files with 401 additions and 127 deletions
23
labscore/utils/interactions.js
Normal file
23
labscore/utils/interactions.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const { MessageFlags, InteractionCallbackTypes } = require("detritus-client/lib/constants")
|
||||
|
||||
const { Context } = require("detritus-client/lib/command")
|
||||
const { InteractionContext } = require("detritus-client/lib/interaction")
|
||||
|
||||
/**
|
||||
* Acknowledges a command or interaction.
|
||||
* @param { InteractionContext|Context } context Command/interaction context
|
||||
* @param { boolean } incognito Specifies if the interaction should run privately (only applicable for interactions)
|
||||
*/
|
||||
module.exports.acknowledge = async function(context, incognito = false){
|
||||
// Interaction flow
|
||||
if(context.editOrRespond){
|
||||
if(incognito){
|
||||
if(!context._meta) context._meta = {};
|
||||
context._meta.isIncognito = true;
|
||||
return await context.respond({data: { flags: MessageFlags.EPHEMERAL }, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE});
|
||||
}
|
||||
return await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
}
|
||||
// Command Flow
|
||||
return await context.triggerTyping()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue