Skip to content

FelipeFlohr/Watch2Gether-DiscordBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watch2Gether Builder + Discord Bot

A Discord Bot which automatically generates a Watch2Gether room and add videos to it. Uses Discord.JS to interact with the Discord API, Spring to "build" the Watch2Gether room and Socket.IO for real time bidirectional communication between the Frontend and Backend

Sections:

1 Requirements

1.0 Requirements using Docker

  • Docker for running the images.

1.1 Requirements without Docker

You may also run the applications without Docker, but I trully recommend you to run with Docker.

2 Setting up

The first thing you should do is to create a file called "bot.json" inside "/discord-bot/backend/" containing the following parameters:

{
  "token": "Your Token ID", // DO NOT EVER SEND YOUR BOT TOKEN ID TO ANYONE. NEVER. NEVER.
  "guildId": "Your Guild ID"
}

The bot will only work within the selected guild because doing it for every guild would be extremely memory-consuming.

By default, the Watch2Gether Bot will only add Twitter and YouTube links to the Watch2Gether room. If you want to add one more platform, feel free to change it on "links.json" inside "/discord-bot/backend/", just be aware that some video players may not work well.

3 Usage

At the root of this repository, execute the following command into your Terminal:

docker-compose up -d

Obs.: to run without Docker you will need to execute each individual application (Selenium App, Backend and Frontend) on your local machine.

Then, if no mistakes were made, the Discord Bot will be online and the command /build will be available, as you can see below:

Before using the command, it's very important to open the Video Opener at your Web Browser. The address is "http://localhost:5500/". The reason why is explained here.

Now you may be able to use the /build command. On its usage, the Bot will try to find the last Watch2Gether link within the last 500 messages at the command's channel. Any link after the last Watch2Gether link will be parsed within the Bot and only the URLs which start with any link provided on "/discord-bot/backend/links.json" are going to be added to the room. If no Watch2Gether link was found, any link within the last 500 messages is going to be parsed.

3.0 The non working videos/"Alternative videos"

Every URL within the command's channel which does not start with any link provided on "/discord-bot/backend/links.json" will not be added to the Watch2Gether room. Instead, it's going to be added to the "Alterinative videos". Also, some videos may failed to be added to the Watch2Gether room, which in this case are going to be added the "Non Working Videos". Therefore, these videos are available in the Video Opener which its address is, by default http://localhost:5500/. When the Bot finishes building the Watch2Gether room, the Video Opener webpage should look like this:

4 Dependencies

Dependencies of this repository:

4.0 "seleniumw2g" dependencies:

4.1 "discord-bot/backend" dependencies:

4.2 "discord-bot/frontend" dependencies:

5 FAQ

Q: Why you didn't you use Node.js' Selenium instead of doing it using Java + Spring

  • A: For some weird reason, Selenium on Node.js didn't work well, so I opted for the Java version.

Q: I found some bug, how can I report?

6 License

Feel free to do whatever you want with this code :)