Coder Social home page Coder Social logo

redrobotsl / discord-sl-chat-relay Goto Github PK

View Code? Open in Web Editor NEW
17.0 6.0 2.0 476 KB

A Discord and Second Life Bot that Relays between the two, and supports multiple channels/groups.

License: MIT License

JavaScript 100.00%
secondlife second-life node-metaverse discordjs discordjs-bot discord discord-bot

discord-sl-chat-relay's Introduction

Contributors Forks Stargazers Issues MIT License


SL Discord Relay Bot

A Discord and Second Life bot capable of relaying messages between inworld Second Life Groups, and Discord Channels.
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Acknowledgments

About The Project

A Discord and Second Life bot capable of relaying messages between inworld Second Life Groups, and Discord Channels, supports (theoretically) as many groups as the second life allows(42 for normal accounts, 70 for premium). This has not been tested with more than 10 groups, your available memory is also a limitation.

(back to top)

Built With

NodeJS-Icon NPM-icon JavaScript-Icon

(back to top)

Getting Started

Prerequisites

  • The Latest NPM:
    npm install npm@latest -g
  • Node:
  • A Discord Bot Token:
    • Refer to This Guide if you are not sure how to do this.
  • Discord Channel ID:
  • Second Life Group UUID:
    • This SL Forums explains how
    • In world the bot must be in the groups you want it to relay.
  • Add your bot to a discord server using this link(add your CLIENT ID from your bot where specified)
  • Add your Second Life Bot account(NOT YOUR ACCOUNT, THE BOTS!) to all the groups you want to relay. Make sure it has Join Chat enabled!

Installation

  1. Clone the repo and open the repository folder:

    git clone https://github.com/redrobotsl/discord-sl-chat-relay.git && cd discord-sl-chat-relay
  2. Run npm install in the folder:

    npm install --no-dev
  3. Copy the .env-example to .env:

    cp .env-example .env
  4. Copy config.js.example to config.js:

    cp config.js.example .config.js
  5. Fill out .env with the required environment variables:

    DISCORD_TOKEN= 
    OWNER= 
    SL_FIRSTNAME= 
    SL_LASTNAME= 
    SL_PASSWORD= 
    SL_START=
  6. Edit config.js to map the inworld group UUIDS to teh Discord Channel IDS:

     relays: new Map([
      ["SL GROUP UUID", "DISCORD CHANNEL ID"] // For just one group no comma after the bracket
     ]),

    For Multiple:

    relays: new Map([
     ["SL Group UUID", "Discord Channel ID"], // For Multiple relays you need a comma after each bracket but the last one
     ["SL Group UUID", "Discord Channel ID"], // For Multiple relays you need a comma after each bracket but the last one
     ["SL Group UUID", "Discord Channel ID"], // For Multiple relays you need a comma after each bracket but the last one
     ["SL Group UUID", "Discord Channel ID"], // For Multiple relays you need a comma after each bracket but the last one
     ["SL Group UUID", "Discord Channel ID"], // For Multiple relays you need a comma after each bracket but the last one
     ["SL Group UUID", "Discord Channel ID"] //  No Comma After the final bracket.
     ]),
  7. Start the bot using:

    node index.js
  8. Invite the bot to your server:

    • Here is how to do it

(back to top)

Roadmap

  • Add Region Restart Evasion with Fallback Regions in the Config File

    • On Region Restart notice, teleport to a fallback region, as well as on login, if can't login to the main region, teleport to a fallback region, don't want your bots sticking around somewhere you don't want it
  • Add Reload Capability of SL and Discord Commands/Event files.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Acknowledgments

(back to top)

discord-sl-chat-relay's People

Contributors

deepsourcebot avatar iamnolanperry avatar snyk-bot avatar vault108 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

discord-sl-chat-relay's Issues

[FEATURE] Handle Teleports and Lures.

Is your feature request related to a problem? Please describe.
Control: Able to be easily managed and maintained.

Describe the solution you'd like
When a teleport is offered from someone on either the friends list, or is the master avatar, it will accept the teleport.

Use Events: Lure and TeleportOffer

[FEATURE] Fallback Regions

Is your feature request related to a problem? Please describe.
Currently, if the region restarts, the bot client doesn't do anything and just dies. If on PM2, as is by the parent company, it will keep trying to auto restart, but this should not be relied on as a behavior. It should try to evade the region restart.

Describe the solution you'd like
Upon recieveing a region restart event, it should try to start cycling through the list of Fallback Regions.

Error: TypeError: Cannot read properties of null

Describe the bug
Error on LLSD Parsing.

To Reproduce

Reproducible in all enviroments.

Screenshots
Error getting seed capability
TypeError: Cannot read properties of null (reading 'nodeName')
at module.exports.LLSD.parseXML (/root/discord-sl-chat-relay/node_modules/@caspertech/llsd/index.js:677:36)
at /root/discord-sl-chat-relay/node_modules/@caspertech/node-metaverse/dist/lib/classes/Caps.js:132:43
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Incomplete instructions

I'm pretty new to using a VPS and github, but I've mainly figured out what the creator of this plugin intends for you to do. I setup a Debian VPS, installed everything that was needed for this relay, edited the .env and config files to reflect what was needed and ...

That's it, what do you do next?

Instructions need expanding, there's no way for me to guess as to how I get this running.

[FEATURE] Restart Evasion

Is your feature request related to a problem? Please describe.
Using Set Fallback Regions, Bot will be able to move to a fallback region when a restart event is received.

Describe the solution you'd like
Upon getting a restart event, begin trying to escape and teleport to the fallback regions.

Add Group Name To Relay

Is your feature request related to a problem? Please describe.
Some people may have multiple groups relaying to one discord channel. It would be helpful to have the group name come over on the webhook. Ideally we can include it in the (inworld) string.

Describe the solution you'd like
Add the group name to the relayed message.

[BUG] Unknown XML-RPC tag

Describe the bug
Throws an error when trying to run the bot. Previously the fix was to set the img string to null in GroupChat.JS

img = await profile.data.split('meta name="imageid" content="')[1].split('" />')[0];
// console.log("Image UUID Recieved: " + img);

This not longer works, as it throws the following error:

[2023-07-29 23:10:50]: READY xxxxx#xxxx, ready to serve 179 users in 1 servers.
Error: Unknown XML-RPC tag 'H1'
    at Deserializer.onError (/root/discord-sl-chat-relay/node_modules/xmlrpc/lib/deserializer.js:115:20)
    at Deserializer.onClosetag (/root/discord-sl-chat-relay/node_modules/xmlrpc/lib/deserializer.js:208:14)
    at SAXStream.emit (node:events:514:28)
    at me._parser.<computed> [as onclosetag] (/root/discord-sl-chat-relay/node_modules/sax/lib/sax.js:258:17)
    at emit (/root/discord-sl-chat-relay/node_modules/sax/lib/sax.js:624:35)
    at emitNode (/root/discord-sl-chat-relay/node_modules/sax/lib/sax.js:629:5)
    at closeTag (/root/discord-sl-chat-relay/node_modules/sax/lib/sax.js:889:7)
    at SAXParser.write (/root/discord-sl-chat-relay/node_modules/sax/lib/sax.js:1436:13)
    at SAXStream.write (/root/discord-sl-chat-relay/node_modules/sax/lib/sax.js:239:18)
    at IncomingMessage.ondata (node:internal/streams/readable:766:22)

Expected behavior
The relay will run

Desktop (please complete the following information):

  • OS: ANY

Additional context
Package List:

sl-discord-relay@0.0.2 /root/discord-sl-chat-relay
├── @caspertech/node-metaverse@0.5.31
├── @discordjs/builders@0.2.0
├── @sapphire/time-utilities@1.7.0
├── 16@0.0.2
├── axios-cache-interceptor@0.9.3
├── axios-retry@3.2.4
├── axios@0.26.0
├── colorette@1.4.0
├── discord.js@13.6.0
├── dotenv@10.0.0
├── eslint-config-airbnb-base@14.2.1
├── eslint-config-standard@16.0.3
├── eslint-plugin-import@2.25.4
├── eslint-plugin-node@11.1.0
├── eslint-plugin-promise@5.2.0
└── eslint@7.32.0

Node Version: v18.17.0
NPM Version: 9.6.7

[FEATURE] Add Ability to forward local chat

Is your feature request related to a problem? Please describe.
It's been requested for the ability to relay local chat.
New Items

  • Add a Option in config.js to enable local chat relaying.
  • Add a String Option in config.js for the discord channel to relay to.
  • Add Event to handle local chat.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.