aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/embed.js26
-rw-r--r--modules/registers.js85
-rw-r--r--modules/result.js3
3 files changed, 88 insertions, 26 deletions
diff --git a/modules/embed.js b/modules/embed.js
index 9c2ab0a..dd846fe 100644
--- a/modules/embed.js
+++ b/modules/embed.js
@@ -173,18 +173,30 @@ module.exports = (page, id, gid) => {
}
}
+ let fields = [
+ { name: l("Nicknames", "Surnoms", id, gid), value: naming, inline: true },
+ { name: l("Sex", "Sexe", id, gid), value: d.sex === "F" ? "♀" : "♂", inline: true },
+ { name: l("Kind", "Type", id, gid), value: kind, inline: true },
+ ];
+
+ if (spoils[id] === 1) {
+ fields.push(
+ { name: l("Occupation(s)", "Occupation(s)", id, gid), value: "(" + l("spoilers", "révélations", id, gid) + ")\n||" + jobs + "||", inline: true },
+ { name: l("Home(s)", "Résidence(s)", id, gid), value: "(" + l("spoilers", "révélations", id, gid) + ")\n||" + location + "||", inline: true }
+ )
+ } else if (spoils[id] === 2) {
+ fields.push(
+ { name: l("Occupation(s)", "Occupation(s)", id, gid), value: jobs, inline: true },
+ { name: l("Home(s)", "Résidence(s)", id, gid), value: location, inline: true }
+ )
+ }
+
return new MessageEmbed()
.setColor(d.color.length === 6 ? d.color : "ffffff")
.setTitle(page + " " + sign)
.setDescription(l(d.extract, d.extract_fr, id, gid))
.setImage(d.image)
.setThumbnail(d.mark)
- .addFields([
- { name: l("Nicknames", "Surnoms", id, gid), value: naming, inline: true },
- { name: l("Sex", "Sexe", id, gid), value: d.sex === "F" ? "♀" : "♂", inline: true },
- { name: l("Kind", "Type", id, gid), value: kind, inline: true },
- { name: l("Occupation(s)", "Occupation(s)", id, gid), value: "(" + l("spoilers", "révélations", id, gid) + ")\n||" + jobs + "||", inline: true },
- { name: l("Home(s)", "Résidence(s)", id, gid), value: "(" + l("spoilers", "révélations", id, gid) + ")\n||" + location + "||", inline: true }
- ])
+ .addFields(fields)
.setFooter(l("Content provided without warranty, use at your own risk.", "Contenu fourni sans aucune garantie, utilisez à vos risques et périls", id, gid))
} \ No newline at end of file
diff --git a/modules/registers.js b/modules/registers.js
index f99e274..a1cf4b5 100644
--- a/modules/registers.js
+++ b/modules/registers.js
@@ -10,27 +10,76 @@ module.exports = [
.setRequired(true)
),
new SlashCommandBuilder()
- .setName('stats')
- .setDescription("Gets stats about the bot"),
- new SlashCommandBuilder()
- .setName('lang')
- .setDescription("Changes the bot's language")
+ .setName('eval')
+ .setDescription("Run raw JavaScript code on the bot's server")
.addStringOption(option =>
- option.setName('locale')
- .setDescription('The selected language')
+ option.setName("code")
+ .setDescription("The JavaScript code to run")
.setRequired(true)
- .addChoice('Français', 'fr')
- .addChoice('English', 'en')
),
new SlashCommandBuilder()
- .setName('serverlang')
- .setDescription("Changes the bot's language on this server")
- .addStringOption(option =>
- option.setName('locale')
- .setDescription('The selected language')
- .setRequired(true)
- .addChoice('Français', 'fr')
- .addChoice('English', 'en')
- .addChoice('User prefered language (default)', 'off')
+ .setName('info')
+ .setDescription("Gets stats and info about the bot"),
+ new SlashCommandBuilder()
+ .setName('random')
+ .setDescription("Picks a random pony"),
+ // new SlashCommandBuilder()
+ // .setName('lang')
+ // .setDescription("Changes the bot's language")
+ // .addStringOption(option =>
+ // option.setName('locale')
+ // .setDescription('The selected language')
+ // .setRequired(true)
+ // .addChoice('Français', 'fr')
+ // .addChoice('English', 'en')
+ // ),
+ new SlashCommandBuilder()
+ .setName('config')
+ .setDescription("Configure all aspects of the bot")
+ .addSubcommand(subcommand =>
+ subcommand.setName('lang')
+ .setDescription("Changes the bot's language")
+ .addStringOption(option =>
+ option.setName('locale')
+ .setDescription('The selected language')
+ .setRequired(true)
+ .addChoice('Français', 'fr')
+ .addChoice('English', 'en')
+ )
+ )
+ .addSubcommand(subcommand =>
+ subcommand.setName('spoilers')
+ .setDescription("Enable, disable or hide spoilers in replies")
+ .addStringOption(option =>
+ option.setName('status')
+ .setDescription('Value')
+ .setRequired(true)
+ .addChoice('Always show spoilers', 'yes')
+ .addChoice('Show under spoiler tags (default)', 'hide')
+ .addChoice('Never show spoilers', 'no')
+ )
)
+ .addSubcommand(subcommand =>
+ subcommand.setName('serverlang')
+ .setDescription("Changes the bot's language on this server")
+ .addStringOption(option =>
+ option.setName('locale')
+ .setDescription('The selected language')
+ .setRequired(true)
+ .addChoice('Français', 'fr')
+ .addChoice('English', 'en')
+ .addChoice('User prefered language (default)', 'off')
+ )
+ ),
+ // new SlashCommandBuilder()
+ // .setName('serverlang')
+ // .setDescription("Changes the bot's language on this server")
+ // .addStringOption(option =>
+ // option.setName('locale')
+ // .setDescription('The selected language')
+ // .setRequired(true)
+ // .addChoice('Français', 'fr')
+ // .addChoice('English', 'en')
+ // .addChoice('User prefered language (default)', 'off')
+ // )
] \ No newline at end of file
diff --git a/modules/result.js b/modules/result.js
index 3f94ebb..42419ec 100644
--- a/modules/result.js
+++ b/modules/result.js
@@ -1,4 +1,5 @@
const db = require('../data/search.json').associations;
+const list = Object.keys(require('../data/data.json'));
const Fuse = require('fuse.js');
module.exports = (query) => {
@@ -25,7 +26,7 @@ module.exports = (query) => {
findex = 0;
for (let result of fuse.search(query)) {
- if (!first.includes(result.item.endpoint) && findex < 3) {
+ if (!first.includes(result.item.endpoint) && findex < 3 && list.includes(result.item.endpoint)) {
first[findex] = result.item.endpoint
findex++
}