|
| 1 | +/* |
| 2 | + Copyright (C) 2024 Alexander Emanuelsson (alexemanuelol) |
| 3 | +
|
| 4 | + This program is free software: you can redistribute it and/or modify |
| 5 | + it under the terms of the GNU General Public License as published by |
| 6 | + the Free Software Foundation, either version 3 of the License, or |
| 7 | + (at your option) any later version. |
| 8 | +
|
| 9 | + This program is distributed in the hope that it will be useful, |
| 10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + GNU General Public License for more details. |
| 13 | +
|
| 14 | + You should have received a copy of the GNU General Public License |
| 15 | + along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | +
|
| 17 | + https://github.com/alexemanuelol/rustplusplus |
| 18 | +
|
| 19 | +*/ |
| 20 | +const DiscordVoice = require('../discordTools/discordVoice.js'); |
| 21 | + |
| 22 | +module.exports = { |
| 23 | + name: 'messageCreate', |
| 24 | + async execute(client, message) { |
| 25 | + if (message.guild) return; |
| 26 | + if (message.author.bot) return; |
| 27 | + |
| 28 | + for (const [guildId, rustplus] of Object.entries(client.rustplusInstances)) { |
| 29 | + if (!rustplus || !rustplus.isOperational) continue; |
| 30 | + |
| 31 | + const instance = client.getInstance(guildId); |
| 32 | + if (instance && instance.blacklist['discordIds'].includes(message.author.id)) continue; |
| 33 | + |
| 34 | + await DiscordVoice.sendDiscordVoiceMessage(guildId, message.cleanContent); |
| 35 | + } |
| 36 | + |
| 37 | + client.log(client.intlGet(null, 'infoCap'), client.intlGet(null, 'logDiscordMessage', { |
| 38 | + guild: 'DM', |
| 39 | + channel: 'DM', |
| 40 | + user: `${message.author.username} (${message.author.id})`, |
| 41 | + message: message.cleanContent |
| 42 | + })); |
| 43 | + }, |
| 44 | +}; |
| 45 | + |
0 commit comments