update: hide install and uninstall response

This commit is contained in:
Oluwatobi Bamidele 2024-03-27 20:03:03 +01:00
parent 57f77c5884
commit f54d2f5bbb
3 changed files with 23 additions and 8 deletions

View file

@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.init = void 0;
exports.init = exports.adminsOnlyBot = void 0;
// import * as SphinxBot from '../../../sphinx-bot'
const Sphinx = require("sphinx-bot");
const botapi_1 = require("../controllers/botapi");
@ -79,6 +79,7 @@ const builtInBotNames = {
spam_gone: 'SpamGoneBot',
[`${ml_1.ML_PREFIX.substring(1)}`]: ml_1.ML_BOTNAME,
};
exports.adminsOnlyBot = ['kick'];
function init() {
const client = new Sphinx.Client();
client.login('_', botapi_1.finalAction);
@ -108,7 +109,8 @@ function init() {
if (existing) {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(botName + ' already installed');
.setDescription(botName + ' already installed')
.setOnlyOwner(exports.adminsOnlyBot.includes(botName) || false);
return message.channel.send({ embed });
}
const msgTypes = builtInBotMsgTypes[botName] || [
@ -132,7 +134,8 @@ function init() {
const theName = builtInBotNames[botName] || 'Bot';
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(theName + ' has been installed!');
.setDescription(theName + ' has been installed!')
.setOnlyOwner(exports.adminsOnlyBot.includes(botName) || false);
message.channel.send({ embed });
}
else {
@ -144,7 +147,8 @@ function init() {
if (existing) {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(botName + ' already installed');
.setDescription(botName + ' already installed')
.setOnlyOwner(exports.adminsOnlyBot.includes(botName) || false);
return message.channel.send({ embed });
}
// bot from tribes registry
@ -159,7 +163,8 @@ function init() {
else {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription('No bot with that name');
.setDescription('No bot with that name')
.setOnlyOwner(exports.adminsOnlyBot.includes(botName) || false);
message.channel.send({ embed });
}
}
@ -182,13 +187,15 @@ function init() {
yield existing2.destroy();
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(botName2 + ' has been removed');
.setDescription(botName2 + ' has been removed')
.setOnlyOwner(exports.adminsOnlyBot.includes(botName2) || false);
return message.channel.send({ embed });
}
else {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription('Cant find a bot by that name');
.setDescription('Cant find a bot by that name')
.setOnlyOwner(exports.adminsOnlyBot.includes(botName2) || false);
return message.channel.send({ embed });
}
case 'search':

File diff suppressed because one or more lines are too long

View file

@ -75,6 +75,8 @@ const builtInBotNames = {
[`${ML_PREFIX.substring(1)}`]: ML_BOTNAME,
}
export const adminsOnlyBot = ['kick']
export function init() {
const client = new Sphinx.Client()
client.login('_', finalAction)
@ -105,6 +107,7 @@ export function init() {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(botName + ' already installed')
.setOnlyOwner(adminsOnlyBot.includes(botName) || false)
return message.channel.send({ embed })
}
const msgTypes = builtInBotMsgTypes[botName] || [
@ -129,6 +132,7 @@ export function init() {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(theName + ' has been installed!')
.setOnlyOwner(adminsOnlyBot.includes(botName) || false)
message.channel.send({ embed })
} else {
const chat = await getTribeOwnersChatByUUID(message.channel.id)
@ -141,6 +145,7 @@ export function init() {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(botName + ' already installed')
.setOnlyOwner(adminsOnlyBot.includes(botName) || false)
return message.channel.send({ embed })
}
// bot from tribes registry
@ -155,6 +160,7 @@ export function init() {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription('No bot with that name')
.setOnlyOwner(adminsOnlyBot.includes(botName) || false)
message.channel.send({ embed })
}
}
@ -178,11 +184,13 @@ export function init() {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription(botName2 + ' has been removed')
.setOnlyOwner(adminsOnlyBot.includes(botName2) || false)
return message.channel.send({ embed })
} else {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')
.setDescription('Cant find a bot by that name')
.setOnlyOwner(adminsOnlyBot.includes(botName2) || false)
return message.channel.send({ embed })
}