From 26a2f14221c761ee4889c443ce2a1a3c33d48dca Mon Sep 17 00:00:00 2001 From: Jacob Fear <71330898+jacobfear@users.noreply.github.com> Date: Wed, 22 Nov 2023 16:35:08 -0500 Subject: [PATCH] Adding Variables and LocalChat Event --- SLevents/ChatEvent.js | 16 ++++++++++++++++ SLevents/GroupChat.js | 1 + config.js | 14 +++++++++++++- index.js | 5 +++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 SLevents/ChatEvent.js diff --git a/SLevents/ChatEvent.js b/SLevents/ChatEvent.js new file mode 100644 index 0000000..e084dab --- /dev/null +++ b/SLevents/ChatEvent.js @@ -0,0 +1,16 @@ +/* eslint-disable no-unused-vars */ +const { permlevel, +} = require('../modules/functions.js'); +const config = require('../config.js'); +const nmv = require('@caspertech/node-metaverse'); +const { MessageEmbed, WebhookClient } = require('discord.js'); +// The MESSAGE event runs anytime a message is received +// Note that due to the binding of client to every event, every event +// goes `client, other, args` when this function is run. + +const { UUID } = nmv.UUID; +module.exports = async (client, ChatEvent) => { + const SLbot = client.container.SLbot; + const currentBot = process.env.SL_FIRSTNAME + ' ' + process.env.SL_LASTNAME; + +}; \ No newline at end of file diff --git a/SLevents/GroupChat.js b/SLevents/GroupChat.js index d83710e..7a324ab 100644 --- a/SLevents/GroupChat.js +++ b/SLevents/GroupChat.js @@ -1,3 +1,4 @@ +/* eslint-disable no-shadow */ /* eslint-disable no-unused-vars */ const { permlevel, } = require('../modules/functions.js'); diff --git a/config.js b/config.js index cfb8e70..c1741a0 100644 --- a/config.js +++ b/config.js @@ -14,11 +14,23 @@ const config = { // //// This maps inworld group UUIDs to Discord Channels. relays: new Map([ - ["1b6af450-96e2-8fad-291c-74fc4928f0b1", "1176644698027331745"] + ['1b6af450-96e2-8fad-291c-74fc4928f0b1', '1176644698027331745'], ]), // Array of SL UUIDs to Ignore and not relay, say if you have a bot that regularly posts in group chat or something. 'ignored': ['49d6a705-de90-4458-b166-ccf56401053c'], /* + + +Settings for local chat relay +*/ + // Enable Local Chat Relay + 'relayLocal': true, + + // Discord Channel to Relay to + 'relayChannel': '1176658491239305266', + /* + + * Intents the bot needs. * By default GuideBot needs Guilds and Guild Messages to work. */ diff --git a/index.js b/index.js index 8a11bce..7e8035c 100644 --- a/index.js +++ b/index.js @@ -50,6 +50,7 @@ client.container = { }; const GroupChatEventHandler = require('./SLevents/GroupChat.js'); +const ChatEventHandler = require('./SLevents/ChatEvent.js'); // We're doing real fancy node 8 async/await stuff here, and to do that // we need to wrap stuff in an anonymous function. It's annoying but it works. @@ -74,6 +75,10 @@ const init = async () => { GroupChatEventHandler(client, eventInfo); }); + client.container.SLbot.clientEvents.onNearbyChat.subscribe((eventInfo) => { + ChatEventHandler(client, eventInfo); + + }); }).catch((error) => {