mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
typing indicator
This commit is contained in:
parent
9716fb1f6e
commit
dca55fd80c
4 changed files with 19 additions and 1 deletions
|
@ -34,6 +34,8 @@ module.exports = {
|
|||
if(args.prompt !== "") prompt = args.prompt
|
||||
|
||||
try{
|
||||
await editOrReply(context, createEmbed("typing", context, "Generating response..."))
|
||||
|
||||
let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
|
||||
.set({
|
||||
Authorization: process.env.AI_SERVER_KEY
|
||||
|
|
|
@ -24,6 +24,8 @@ module.exports = {
|
|||
context.triggerTyping();
|
||||
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
||||
try{
|
||||
await editOrReply(context, createEmbed("typing", context, "Generating response..."))
|
||||
|
||||
let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
|
||||
.set({
|
||||
Authorization: process.env.AI_SERVER_KEY
|
||||
|
|
|
@ -78,6 +78,15 @@ const embedTypes = Object.freeze({
|
|||
},
|
||||
color: COLORS.embed
|
||||
}
|
||||
},
|
||||
"typing": (context) => {
|
||||
return {
|
||||
author: {
|
||||
iconUrl: STATIC_ICONS.typing,
|
||||
name: `Loading`
|
||||
},
|
||||
color: COLORS.embed
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -87,7 +96,7 @@ module.exports.createEmbed = function(type, context, content){
|
|||
if(!content) embedTypes[type](context)
|
||||
let emb = embedTypes[type](context)
|
||||
|
||||
if(["success","warning","error","loading"].includes(type)){
|
||||
if(["success","warning","error","loading","typing"].includes(type)){
|
||||
emb.author.name = content
|
||||
return emb
|
||||
}
|
||||
|
|
|
@ -102,6 +102,10 @@ const Statics = Object.freeze({
|
|||
file: "icons/core/ico_notice_loading.gif",
|
||||
revision: 0
|
||||
},
|
||||
typing: {
|
||||
file: "icons/core/ico_notice_typing.gif",
|
||||
revision: 0
|
||||
},
|
||||
warning: {
|
||||
file: "icons/core/ico_notice_warning.png",
|
||||
revision: 0
|
||||
|
@ -145,5 +149,6 @@ module.exports.STATIC_ICONS = Object.freeze({
|
|||
adult: staticAsset(Statics.icons.adult),
|
||||
error: staticAsset(Statics.icons.error),
|
||||
loading: staticAsset(Statics.icons.loading),
|
||||
typing: staticAsset(Statics.icons.typing),
|
||||
warning: staticAsset(Statics.icons.warning)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue