From 03053a8c0762657621abd7c03b5edf77073912d5 Mon Sep 17 00:00:00 2001 From: Minteck Date: Mon, 14 Feb 2022 13:53:25 +0100 Subject: Add buttons to /info --- .idea/copyright/MIT.xml | 6 +++++ .idea/copyright/profiles_settings.xml | 7 +++++ bot.js | 29 ++++++++++++++++++-- commands/config.js | 27 ++++++++++++++++++- commands/episode.js | 27 ++++++++++++++++++- commands/eval.js | 27 ++++++++++++++++++- commands/help.js | 27 ++++++++++++++++++- commands/info.js | 50 +++++++++++++++++++++++++++++++++-- commands/pony.js | 27 ++++++++++++++++++- commands/random.js | 27 ++++++++++++++++++- config/version.txt | 2 +- handler/button.js | 29 ++++++++++++++++++-- handler/command.js | 27 ++++++++++++++++++- handler/errors.js | 31 ++++++++++++++++++++-- handler/menu.js | 27 ++++++++++++++++++- index.js | 29 ++++++++++++++++++-- modules/embed.js | 27 ++++++++++++++++++- modules/emoji.js | 25 ++++++++++++++++++ modules/episodepublic.js | 27 ++++++++++++++++++- modules/episodereply.js | 27 ++++++++++++++++++- modules/findepisode.js | 25 ++++++++++++++++++ modules/findpony.js | 25 ++++++++++++++++++ modules/generation.js | 25 ++++++++++++++++++ modules/help.js | 37 +++++++++++++++++++++++--- modules/icons.js | 25 ++++++++++++++++++ modules/kind.js | 25 ++++++++++++++++++ modules/pixel.js | 25 ++++++++++++++++++ modules/public.js | 29 ++++++++++++++++++-- modules/registers.js | 31 +++++++++++++++++++++- modules/result.js | 27 ++++++++++++++++++- update/episodes/index.js | 25 ++++++++++++++++++ update/ponies/dict.js | 25 ++++++++++++++++++ update/ponies/index.js | 35 ++++++++++++++++++++---- update/ponies/infobox.js | 31 +++++++++++++++++++--- update/ponies/listgen.js | 27 ++++++++++++++++++- update/ponies/pages.js | 25 ++++++++++++++++++ update/ponies/parse.js | 25 ++++++++++++++++++ 37 files changed, 934 insertions(+), 38 deletions(-) create mode 100644 .idea/copyright/MIT.xml create mode 100644 .idea/copyright/profiles_settings.xml diff --git a/.idea/copyright/MIT.xml b/.idea/copyright/MIT.xml new file mode 100644 index 0000000..8993a3a --- /dev/null +++ b/.idea/copyright/MIT.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..c1e2ebc --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/bot.js b/bot.js index 33008ef..7d70a51 100644 --- a/bot.js +++ b/bot.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + // Stable: https://discord.com/oauth2/authorize?client_id=928695013083316295&scope=bot%20applications.commands&permissions=0 // Beta: https://discord.com/oauth2/authorize?client_id=929057534491361341&scope=bot%20applications.commands&permissions=0 @@ -5,8 +30,8 @@ console.log("Channel: " + (require('fs').existsSync("./beta") ? "beta" : "stable global.channel = (require('fs').existsSync("./beta") ? "beta" : "stable"); const fs = require('fs'); -const { REST } = require('@discordjs/rest'); -const { Routes } = require('discord-api-types/v9'); +const {REST} = require('@discordjs/rest'); +const {Routes} = require('discord-api-types/v9'); if (!fs.existsSync("./user/userdata.json")) fs.writeFileSync("./user/userdata.json", "{}"); if (!fs.existsSync("./user/spoilers.json")) fs.writeFileSync("./user/spoilers.json", "{}"); diff --git a/commands/config.js b/commands/config.js index 42c0a7e..ae2d135 100644 --- a/commands/config.js +++ b/commands/config.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); diff --git a/commands/episode.js b/commands/episode.js index e79e9b0..b7d536a 100644 --- a/commands/episode.js +++ b/commands/episode.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const getEpisodePublic = require("../modules/episodepublic"); const episodeReply = require("../modules/episodereply"); diff --git a/commands/eval.js b/commands/eval.js index 49c8162..288aca9 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); diff --git a/commands/help.js b/commands/help.js index 6c0cd1b..0edad0a 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); diff --git a/commands/info.js b/commands/info.js index aaa4dc5..b9f4a34 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); @@ -108,7 +133,28 @@ module.exports = async (interaction) => { .setTitle(l("Bot stats", "Statistiques du robot", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) .setDescription(l("Ponyfind is a Discord bot that helps you get easy and fast access to data relative to My Little Pony (generations 4 and 5).", "Ponyfind est un robot Discord qui vous aide à obtenir un accès simple et rapide à des données relatives à My Little Pony (générations 4 et 5).", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) .addFields(fields) - .setFooter({ text: l("made with ♥ by Minteck, a My Little Pony fan", "fait avec ♥ par Minteck, une fan de My Little Pony", interaction.user.id, interaction.guild ? interaction.guild.id : 0) }) + .setFooter({text: l("made with ♥ by Minteck, a My Little Pony fan", "fait avec ♥ par Minteck, une fan de My Little Pony", interaction.user.id, interaction.guild ? interaction.guild.id : 0)}) + ], + components: [ + new MessageActionRow() + .addComponents( + new MessageButton() + .setStyle("LINK") + .setURL("https://gitlab.minteck.org/minteck/ponyfind") + .setLabel(l("Source Code", "Code source", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) + ) + .addComponents( + new MessageButton() + .setStyle("LINK") + .setURL("https://minteck.org/legal/#/privacy") + .setLabel(l("Data Privacy", "Politique de confidentialité", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) + ) + .addComponents( + new MessageButton() + .setStyle("LINK") + .setURL("https://minteck.org/legal/#/terms") + .setLabel(l("Terms and Conditions", "Conditions d'utilisation", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) + ) ] }); } diff --git a/commands/pony.js b/commands/pony.js index cd83c66..3b853d5 100644 --- a/commands/pony.js +++ b/commands/pony.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); diff --git a/commands/random.js b/commands/random.js index a5ddfe2..a3521ff 100644 --- a/commands/random.js +++ b/commands/random.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); diff --git a/config/version.txt b/config/version.txt index 07d2de1..a1ae812 100644 --- a/config/version.txt +++ b/config/version.txt @@ -1 +1 @@ -2.0.58 \ No newline at end of file +2.1.59 \ No newline at end of file diff --git a/handler/button.js b/handler/button.js index f8b4cb8..144b47e 100644 --- a/handler/button.js +++ b/handler/button.js @@ -1,6 +1,31 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const path = require('path'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed, MessageAttachment } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed, MessageAttachment} = require('discord.js'); const getPixel = require('../modules/pixel.js'); const getEmbed = require("../modules/embed"); @@ -23,7 +48,7 @@ module.exports = async (interaction) => { let ep = keys[2].split("-")[1]; let se = keys[2].split("-")[0]; let sep = keys[2].split("-")[0].substring(1); - + try { await interaction.update({ ephemeral: interaction.guild !== null, diff --git a/handler/command.js b/handler/command.js index 9733e6c..2be1c92 100644 --- a/handler/command.js +++ b/handler/command.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); const admin = fs.readFileSync("./config/admin.txt").toString().trim(); const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); diff --git a/handler/errors.js b/handler/errors.js index 9924353..a8cf32b 100644 --- a/handler/errors.js +++ b/handler/errors.js @@ -1,8 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); module.exports = async (interaction, e) => { - if (e.name === "DiscordAPIError") { return; } + if (e.name === "DiscordAPIError") { + return; + } console.error(e); tid = "./reports/Telemetry-Crash-" + (new Date().toISOString().replace(/[^a-zA-Z0-9]/gm, "-")) + ".txt"; diff --git a/handler/menu.js b/handler/menu.js index f4cc3bc..b786c47 100644 --- a/handler/menu.js +++ b/handler/menu.js @@ -1,5 +1,30 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); -const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); +const {MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed} = require('discord.js'); module.exports = async (interaction) => { keys = interaction.values[0].split("|") diff --git a/index.js b/index.js index 8cf19a2..060aa6b 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,33 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + global.channel = (require('fs').existsSync("./beta") ? "beta" : "stable"); -const { ShardingManager } = require('discord.js'); +const {ShardingManager} = require('discord.js'); const fs = require("fs"); -const manager = new ShardingManager('./bot.js', { token: fs.readFileSync("./config/token." + (require('fs').existsSync("./beta") ? "beta" : "stable") + ".txt").toString() }); +const manager = new ShardingManager('./bot.js', {token: fs.readFileSync("./config/token." + (require('fs').existsSync("./beta") ? "beta" : "stable") + ".txt").toString()}); manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`)); diff --git a/modules/embed.js b/modules/embed.js index 23bd392..9766055 100644 --- a/modules/embed.js +++ b/modules/embed.js @@ -1,4 +1,29 @@ -const { MessageEmbed } = require("discord.js"); +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +const {MessageEmbed} = require("discord.js"); const fs = require('fs'); const data = require('../data/data.json'); diff --git a/modules/emoji.js b/modules/emoji.js index 10e3b44..3916a5e 100644 --- a/modules/emoji.js +++ b/modules/emoji.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + module.exports = (emoji, member, guild) => { if (guild) { let me = guild.me; diff --git a/modules/episodepublic.js b/modules/episodepublic.js index 629ed69..1b1ac64 100644 --- a/modules/episodepublic.js +++ b/modules/episodepublic.js @@ -1,4 +1,29 @@ -const { MessageButton } = require("discord.js"); +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +const {MessageButton} = require("discord.js"); module.exports = (interaction, series, episode) => { let ep = episode.split("-")[1] - 1 + 1; diff --git a/modules/episodereply.js b/modules/episodereply.js index 79a05c1..3d60a0b 100644 --- a/modules/episodereply.js +++ b/modules/episodereply.js @@ -1,4 +1,29 @@ -const { MessageActionRow, MessageButton, MessageEmbed } = require("discord.js"); +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +const {MessageActionRow, MessageButton, MessageEmbed} = require("discord.js"); const getEpisodePublic = require("./episodepublic"); const fs = require("fs"); diff --git a/modules/findepisode.js b/modules/findepisode.js index fd56a65..0c2313c 100644 --- a/modules/findepisode.js +++ b/modules/findepisode.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const Fuse = require('fuse.js'); module.exports = (series, query) => { diff --git a/modules/findpony.js b/modules/findpony.js index 9159cc6..15fd865 100644 --- a/modules/findpony.js +++ b/modules/findpony.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const Fuse = require('fuse.js'); const assocs = require('../data/search.json').associations; const list = Object.keys(require('../data/data.json')); diff --git a/modules/generation.js b/modules/generation.js index da5cd60..1f5553f 100644 --- a/modules/generation.js +++ b/modules/generation.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const db = JSON.parse(fs.readFileSync("./data/data.json").toString()); diff --git a/modules/help.js b/modules/help.js index c507378..77925c0 100644 --- a/modules/help.js +++ b/modules/help.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const {MessageEmbed} = require("discord.js"); module.exports = (guild, gid, uid, inMessage) => { if (inMessage === undefined) { @@ -5,8 +30,14 @@ module.exports = (guild, gid, uid, inMessage) => { } let fields = [ - { name: l("Search for a pony", "Rechercher un poney", uid, guild ? gid : 0), value: l("With the `/pony` command, you can search for any known pony from My Little Pony generations 4 and 5.", "Avec la commande `/pony`, vous pouvez chercher n'importe quel poney de My Little Pony générations 4 ou 5.", uid, guild ? gid : 0) }, - { name: l("Enable or disable spoilers", "Activer ou désactiver le révélations", uid, guild ? gid : 0), value: l("With `/config spoilers`, you can adjust whether or not you want to see spoilers.", "Avec `/config spoilers`, vous pouvez ajuster si vous voulez ou non voir des révélations.", uid, guild ? gid : 0) }, + { + name: l("Search for a pony", "Rechercher un poney", uid, guild ? gid : 0), + value: l("With the `/pony` command, you can search for any known pony from My Little Pony generations 4 and 5.", "Avec la commande `/pony`, vous pouvez chercher n'importe quel poney de My Little Pony générations 4 ou 5.", uid, guild ? gid : 0) + }, + { + name: l("Enable or disable spoilers", "Activer ou désactiver le révélations", uid, guild ? gid : 0), + value: l("With `/config spoilers`, you can adjust whether or not you want to see spoilers.", "Avec `/config spoilers`, vous pouvez ajuster si vous voulez ou non voir des révélations.", uid, guild ? gid : 0) + }, { name: l("Get stats about the bot", "Obtenir des statistiques sur le robot", uid, guild ? gid : 0), value: l("`/info` helps you get stats and other useful information about the bot and its inner workings.", "`/info` vous permet d'obtenir des statistiques ainsi que d'autres informations utiles à propos du robot et de son fonctionnement.", uid, guild ? gid : 0) }, { name: l("Having issues with custom emojis?", "Vous avez des problèmes avec les emojis personnalisés ?", uid, guild), value: l("Ponyfind relies on custom emojis in some commands. If they don't show properly, make sure both the bot and the \\@everyone have the permission to use external emojis.", "Ponyfind s'appuie sur des emojis personnalisés dans certaines commandes. Si ils ne s'affichent pas correctement, assurez-vous que le robot ainsi que le role \\@everyone disposent de la permission d'utiliser des emojis externes", uid, guild) }, { name: l("Add some more magic!", "Ajouter encore plus de magie !", uid, guild ? gid : 0), value: l("Try `/random`, you will be surprised!.", "Essayez `/random`, vous serez surpris(e) !", uid, guild ? gid : 0) }, @@ -26,6 +57,6 @@ module.exports = (guild, gid, uid, inMessage) => { if (!inMessage) { obj.ephemeral = guild !== null; } - + return obj; } \ No newline at end of file diff --git a/modules/icons.js b/modules/icons.js index 13651cd..a68d6ed 100644 --- a/modules/icons.js +++ b/modules/icons.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); module.exports = { diff --git a/modules/kind.js b/modules/kind.js index 205014e..522e426 100644 --- a/modules/kind.js +++ b/modules/kind.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const db = JSON.parse(fs.readFileSync("./data/data.json").toString()); diff --git a/modules/pixel.js b/modules/pixel.js index ec6ee0a..9e5330d 100644 --- a/modules/pixel.js +++ b/modules/pixel.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const Fuse = require('fuse.js'); const list = fs.readdirSync("./pixel"); diff --git a/modules/public.js b/modules/public.js index 8c43df8..293bafd 100644 --- a/modules/public.js +++ b/modules/public.js @@ -1,10 +1,35 @@ -const { MessageButton } = require("discord.js"); +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +const {MessageButton} = require("discord.js"); module.exports = (interaction, keys) => { if (typeof cooldowns[interaction.user.id] !== "undefined" && new Date() - cooldowns[interaction.user.id] < 30000) { return new MessageButton() .setCustomId("pony.public|" + keys[1]) - .setLabel(l("Wait " + Math.ceil((30000 - (new Date() - cooldowns[interaction.user.id]))/1000) + " seconds", "Patientez " + Math.ceil((30000 - (new Date() - cooldowns[interaction.user.id]))/1000) + " secondes", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) + .setLabel(l("Wait " + Math.ceil((30000 - (new Date() - cooldowns[interaction.user.id])) / 1000) + " seconds", "Patientez " + Math.ceil((30000 - (new Date() - cooldowns[interaction.user.id])) / 1000) + " secondes", interaction.user.id, interaction.guild ? interaction.guild.id : 0)) .setStyle("PRIMARY") .setDisabled(true); } else { diff --git a/modules/registers.js b/modules/registers.js index f2f13c7..24b0fc9 100644 --- a/modules/registers.js +++ b/modules/registers.js @@ -1,4 +1,33 @@ -const { SlashCommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandBuilder } = require('@discordjs/builders'); +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +const { + SlashCommandBuilder, + SlashCommandSubcommandGroupBuilder, + SlashCommandSubcommandBuilder +} = require('@discordjs/builders'); const fs = require('fs'); let episodesCmd = new SlashCommandBuilder() diff --git a/modules/result.js b/modules/result.js index d83c550..b381cda 100644 --- a/modules/result.js +++ b/modules/result.js @@ -1,10 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const db = require('../data/search.json').associations; const list = Object.keys(require('../data/data.json')); const Fuse = require('fuse.js'); module.exports = (query) => { const fuse = new Fuse(db, { - keys: [ 'title', 'endpoint' ] + keys: ['title', 'endpoint'] }) let results = []; diff --git a/update/episodes/index.js b/update/episodes/index.js index f39757a..1ae0ec3 100644 --- a/update/episodes/index.js +++ b/update/episodes/index.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const config = require("./series.json"); const axios = require('axios'); const fs = require('fs'); diff --git a/update/ponies/dict.js b/update/ponies/dict.js index 88ec568..c72a19e 100644 --- a/update/ponies/dict.js +++ b/update/ponies/dict.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); console.log("Optimizing search engine..."); diff --git a/update/ponies/index.js b/update/ponies/index.js index 53acf34..0cc6af8 100644 --- a/update/ponies/index.js +++ b/update/ponies/index.js @@ -1,5 +1,30 @@ -require('child_process').spawnSync("node", ["update/listgen.js"], { cwd: __dirname + "/..", stdio: "inherit" }) -require('child_process').spawnSync("node", ["update/pages.js"], { cwd: __dirname + "/..", stdio: "inherit" }) -require('child_process').spawnSync("node", ["update/infobox.js"], { cwd: __dirname + "/..", stdio: "inherit" }) -require('child_process').spawnSync("node", ["update/parse.js"], { cwd: __dirname + "/..", stdio: "inherit" }) -require('child_process').spawnSync("node", ["update/dict.js"], { cwd: __dirname + "/..", stdio: "inherit" }) \ No newline at end of file +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +require('child_process').spawnSync("node", ["update/listgen.js"], {cwd: __dirname + "/..", stdio: "inherit"}) +require('child_process').spawnSync("node", ["update/pages.js"], {cwd: __dirname + "/..", stdio: "inherit"}) +require('child_process').spawnSync("node", ["update/infobox.js"], {cwd: __dirname + "/..", stdio: "inherit"}) +require('child_process').spawnSync("node", ["update/parse.js"], {cwd: __dirname + "/..", stdio: "inherit"}) +require('child_process').spawnSync("node", ["update/dict.js"], {cwd: __dirname + "/..", stdio: "inherit"}) \ No newline at end of file diff --git a/update/ponies/infobox.js b/update/ponies/infobox.js index f53be0e..d3ca174 100644 --- a/update/ponies/infobox.js +++ b/update/ponies/infobox.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const axios = require("axios"); const WikiTextParser = require('parse-wikitext'); @@ -50,12 +75,12 @@ console.log("Gathering infobox for each page..."); } try { if (mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.toLowerCase().includes("friendship is magic") - || mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.toLowerCase().includes("fim") + || mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.toLowerCase().includes("fim") ) { infoboxes[page.name]["_gen"] = 4; } else if (mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.toLowerCase().includes("a new generation") - || mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.replace(/[.,?!;()"'-]/g, " ").replace(/\s+/g, " ").toLowerCase().split(" ").includes("ang") - || mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.replace(/[.,?!;()"'-]/g, " ").replace(/\s+/g, " ").toLowerCase().split(" ").includes("ang") + || mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.replace(/[.,?!;()"'-]/g, " ").replace(/\s+/g, " ").toLowerCase().split(" ").includes("ang") + || mwtext.query.pages[Object.keys(mwextracts.query.pages)[0]].extract.replace(/[.,?!;()"'-]/g, " ").replace(/\s+/g, " ").toLowerCase().split(" ").includes("ang") ) { infoboxes[page.name]["_gen"] = 5; } else { diff --git a/update/ponies/listgen.js b/update/ponies/listgen.js index d9401f8..4e07607 100644 --- a/update/ponies/listgen.js +++ b/update/ponies/listgen.js @@ -1,7 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const axios = require("axios"); const fs = require("fs"); -if (fs.existsSync("./data")) fs.rmSync("./data", { recursive: true }); +if (fs.existsSync("./data")) fs.rmSync("./data", {recursive: true}); fs.mkdirSync("./data"); (async () => { diff --git a/update/ponies/pages.js b/update/ponies/pages.js index 7f3a1c8..af14362 100644 --- a/update/ponies/pages.js +++ b/update/ponies/pages.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const axios = require('axios'); diff --git a/update/ponies/parse.js b/update/ponies/parse.js index bd06081..8cf797d 100644 --- a/update/ponies/parse.js +++ b/update/ponies/parse.js @@ -1,3 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2022- Minteck + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + const fs = require('fs'); const axios = require('axios'); -- cgit