diff --git a/Main.js b/Main.js index 3080dcb..f308ecf 100644 --- a/Main.js +++ b/Main.js @@ -75,6 +75,8 @@ client.on("message", async msg => { if (!msg.guild.dbLoaded) await msg.guild.dbLoad(); lgr.message.giveNickHeart(msg); } + + lgr.message.run(msg); }); client.on("guildMemberRemove", async (member) => { diff --git a/cmds/fun/chat.js b/cmds/fun/chat.js index 0da3590..72512fb 100644 --- a/cmds/fun/chat.js +++ b/cmds/fun/chat.js @@ -19,6 +19,6 @@ module.exports = class chat extends commando.Command { } msg.channel.startTyping(); return trySend(this.client, msg, await chatAnswer( - msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length).trim())); + msg.cleanContent.slice((msg.guild.commandPrefix + msg.alias).length + 1).trim())); } }; \ No newline at end of file diff --git a/cmds/utility/translate.js b/cmds/utility/translate.js new file mode 100644 index 0000000..1f5fde8 --- /dev/null +++ b/cmds/utility/translate.js @@ -0,0 +1,107 @@ +'use strict'; + +const commando = require("@iceprod/discord.js-commando"); +const { default: axios } = require("axios"); +const { Message } = require("discord.js"); +const { trySend, getChannelMessage, defaultImageEmbed } = require("../../resources/functions"); +const SPLG = [ + "en", + "ar", + "zh", + "fr", + "de", + "hi", + "id", + "ga", + "it", + "ja", + "ko", + "pl", + "pt", + "ru", + "es", + "tr", + "vi" +], + REG = /(?"); + } + const res = await axios.post("https://translate.mentality.rip/translate", { + q: trans, + source: "auto", + target: tar + }).then(r => { + console.log(r.data); + return r.data.translatedText; + }).catch(console.error); + return trySend(msg.client, msg, res); + } +}; \ No newline at end of file diff --git a/resources/eventsLogger/message.js b/resources/eventsLogger/message.js index 90ab80f..b188a5f 100644 --- a/resources/eventsLogger/message.js +++ b/resources/eventsLogger/message.js @@ -28,4 +28,8 @@ async function letsChat(msg) { } } -module.exports = { letsChat, giveNickHeart } \ No newline at end of file +function run(msg) { + msg.channel.pushLastMessagesID(); +} + +module.exports = { letsChat, giveNickHeart, run } \ No newline at end of file diff --git a/resources/structures.js b/resources/structures.js index 5c351ee..80172ea 100644 --- a/resources/structures.js +++ b/resources/structures.js @@ -155,4 +155,36 @@ Structures.extend("User", u => { }); } } +}); + +Structures.extend("TextChannel", e => { + return class TextChannel extends e { + constructor(guild, data) { + super(guild, data); + this.lastMessagesID = []; + }; + + pushLastMessagesID() { + if (this.lastMessagesID.length === 3) { + this.lastMessagesID.shift(); + }; + return this.lastMessagesID.push(this.lastMessageID); + }; + } +}); + +Structures.extend("DMChannel", e => { + return class DMChannel extends e { + constructor(client, data) { + super(client, data); + this.lastMessagesID = []; + }; + + pushLastMessagesID() { + if (this.lastMessagesID.length === 3) { + this.lastMessagesID.shift(); + }; + return this.lastMessagesID.push(this.lastMessageID); + }; + } }); \ No newline at end of file diff --git a/resources/tCmds/convo.js b/resources/tCmds/convo.js index 73400dc..fa99754 100644 --- a/resources/tCmds/convo.js +++ b/resources/tCmds/convo.js @@ -71,7 +71,7 @@ module.exports = { if (u.startsWith("u ")) { const n = parseInt(u.match(/\d+/), 10); console.log("Removing", C[n].name, C[n].id); - return delete C[n]; + return C.splice(n, 1); } if (u === "r") { if (C.length > 0) {