mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
limited test command system
This commit is contained in:
parent
00873fa78e
commit
cde456f913
4 changed files with 34 additions and 11 deletions
|
@ -7,6 +7,7 @@ const { paginator } = require('../../../labscore/client');
|
||||||
const { editOrReply } = require('../../../labscore/utils/message');
|
const { editOrReply } = require('../../../labscore/utils/message');
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
const { canUseLimitedTestCommands } = require('../utils/testing');
|
||||||
|
|
||||||
function createHelpPage(context, title, contents, descriptions){
|
function createHelpPage(context, title, contents, descriptions){
|
||||||
return {
|
return {
|
||||||
|
@ -113,6 +114,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||||
run: async (context, args) => {
|
run: async (context, args) => {
|
||||||
|
if(canUseLimitedTestCommands(context)) categories["limited"] = `${icon("fun")} Limited Test Commands`;
|
||||||
if(args.command){
|
if(args.command){
|
||||||
await context.triggerTyping()
|
await context.triggerTyping()
|
||||||
// Detailed command view
|
// Detailed command view
|
||||||
|
|
|
@ -3,23 +3,24 @@ const { format } = require('../../../labscore/utils/ansi')
|
||||||
const { editOrReply } = require('../../../labscore/utils/message')
|
const { editOrReply } = require('../../../labscore/utils/message')
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
const { codeblock } = require('../../../labscore/utils/markdown')
|
const { codeblock, iconPill } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
const { canUseLimitedTestCommands } = require('../utils/testing')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'chat',
|
name: 'chat',
|
||||||
label: 'text',
|
label: 'text',
|
||||||
metadata: {
|
metadata: {
|
||||||
description: `Talk to ChatGPT.\n\n<:bonzi:1138585089891106836> He will explore the Internet with you as your very own friend and sidekick! He can talk, walk, and joke like no other friend you've ever had!`,
|
description: `${iconPill("fun", "LIMITED TESTING")}\n\nTalk to ChatGPT.\n\n<:bonzi:1138585089891106836> He will explore the Internet with you as your very own friend and sidekick! He can talk, walk, and joke like no other friend you've ever had!`,
|
||||||
description_short: 'Talk to ChatGPT.',
|
description_short: 'Talk to ChatGPT.',
|
||||||
examples: ['chat How many otter species are there?'],
|
examples: ['chat How many otter species are there?'],
|
||||||
category: 'hidden',
|
category: 'limited',
|
||||||
usage: 'chat <prompt>'
|
usage: 'chat <prompt>'
|
||||||
},
|
},
|
||||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||||
run: async (context, args) => {
|
run: async (context, args) => {
|
||||||
if(!process.env.TESTING_SERVER_IDS.split(';').includes(context.guild.id)) return;
|
if(!canUseLimitedTestCommands(context)) return;
|
||||||
context.triggerTyping();
|
context.triggerTyping();
|
||||||
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -3,23 +3,24 @@ const { format } = require('../../../labscore/utils/ansi')
|
||||||
const { editOrReply } = require('../../../labscore/utils/message')
|
const { editOrReply } = require('../../../labscore/utils/message')
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
const { codeblock } = require('../../../labscore/utils/markdown')
|
const { codeblock, iconPill } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
const { canUseLimitedTestCommands } = require('../utils/testing')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'disstrack',
|
name: 'disstrack',
|
||||||
label: 'text',
|
label: 'text',
|
||||||
metadata: {
|
metadata: {
|
||||||
description: `Talk to ChatGPT.\n\n<:bonzi:1138585089891106836> He will explore the Internet with you as your very own friend and sidekick! He can talk, walk, and joke like no other friend you've ever had!`,
|
description: `${iconPill("fun", "LIMITED TESTING")}\n\nAI Generated Disstracks, powered by ChatGPT`,
|
||||||
description_short: 'Talk to ChatGPT.',
|
description_short: 'AI generated disstracks.',
|
||||||
examples: ['chat How many otter species are there?'],
|
examples: ['disstrack'],
|
||||||
category: 'hidden',
|
category: 'limited',
|
||||||
usage: 'chat <prompt>'
|
usage: 'disstrack <prompt>'
|
||||||
},
|
},
|
||||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||||
run: async (context, args) => {
|
run: async (context, args) => {
|
||||||
if(!process.env.TESTING_SERVER_IDS.split(';').includes(context.guild.id)) return;
|
if(!canUseLimitedTestCommands(context)) return;
|
||||||
context.triggerTyping();
|
context.triggerTyping();
|
||||||
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
||||||
try{
|
try{
|
||||||
|
|
19
commands/message/utils/testing.js
Normal file
19
commands/message/utils/testing.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
// Get Test Config
|
||||||
|
let LIMITED_TEST_GUILDS;
|
||||||
|
if(process.env.TESTING_SERVER_IDS) LIMITED_TEST_GUILDS = process.env.TESTING_SERVER_IDS.split(';')
|
||||||
|
let LIMITED_TEST_CHANNELS;
|
||||||
|
if(process.env.TESTING_CHANNEL_IDS) LIMITED_TEST_CHANNELS = process.env.TESTING_CHANNEL_IDS.split(';')
|
||||||
|
let LIMITED_TEST_USERS;
|
||||||
|
if(process.env.TESTING_USER_IDS) LIMITED_TEST_USERS = process.env.TESTING_USER_IDS.split(';')
|
||||||
|
|
||||||
|
function canUseLimitedTestCommands(context){
|
||||||
|
if(LIMITED_TEST_GUILDS && LIMITED_TEST_GUILDS.includes(context.guild.id)) return true;
|
||||||
|
if(LIMITED_TEST_CHANNELS && LIMITED_TEST_CHANNELS.includes(context.channel.id)) return true;
|
||||||
|
if(LIMITED_TEST_USERS && LIMITED_TEST_USERS.includes(context.user.id)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
canUseLimitedTestCommands
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue