Giter Club home page Giter Club logo

twitch_discord_barrycarlyon_co_uk's Introduction

What is this

This repo contains the code for https://twitch.discord.barrycarlyon.co.uk, a Twitch Go Live Notification System for Discord

Languages

It's written in NodeJS

Documentation

It uses the following API reference documentation

What does it look like?

Example Discord Notification

Running it yourself

This system uses MySQL as a Database backend and Redis for session handling and message brokering between the two services

  • Import sql/barrys_discord_twitch.sql to your MySQL database

  • Copy .env.sample to .env

  • Revise the settings within, for your Discord Application and Twitch Applications.

  • Revise that database access settings

  • Make sure to update the URLs, and Twitch EventSub

  • npm install

It's expected to your PM2 as a process manager. So you can either use PM2 or run the two jobs another way

  • pm2 start app.json

or start the two jobs manually

  • node server.js
  • node utils/runner.js

Using TwitchCLI to test

You can use the Twitch-cli to test your Eventsub callback see https://github.com/twitchdev/twitch-cli/ and look under Events

Example:

twitch event verify-subscription stream.online -s "THESECRETISCOOL" -F "https://twitch.discord.barrycarlyon.co.uk/eventsub/"

You would naturally swap the URL to the URL for your instance of the project.

License

This project is Licensed under DO WHAT THE FUCK YOU WANT Image/logo assets remain the property/licensing of their resepective owners

OMGLIEKWUT OHMYGOODNESS U SO MUCH HELP

Thank you for the help I want to give you beer/coffee money -> Check the Funding/Sponsor details

Nginx and Cookie Security

This is an example, so doesn't contain all the best security practices. Since this uses cookies to manage logins you should change the session code to something like. And the paired app.user to sanity check/enforce the right domain for cookies to behave

app.use(session({
    store: new RedisStore({
        client: redis_client
    }),
    secret,
    resave: true,
    saveUninitialized: false,
    cookie: {
        secure: true,
        httpOnly: true,
        domain: config.server.domain
    },
    rolling: true
}));

app.use((req, res, next) => {
    if (req.hostname != config.server.domain) {
        res.redirect(`https://${config.server.domain}/${req.originalUrl}`);
        return;
    }

Change the domain as needed!

See also Production Best Practices: Security

If you are putting this nodeJS HTTP server beind NGINX, your NGINX declartion for the location will need additional fields:

server {
    listen IPv4:443;
    listen [::]:443;

    server_name example.com;
    root /some/path/to/files;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
        # Cookie Flags
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        # Cookie Flags
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        # Other

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;

        proxy_pass http://this_server_relay;
    }
}

upstream this_server_relay {
    server 127.0.0.1:5000;
    keepalive 8;
}

twitch_discord_barrycarlyon_co_uk's People

Contributors

barrycarlyon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

psingletary

twitch_discord_barrycarlyon_co_uk's Issues

Roles picker and opt in

Brief description

Provdie a optimised way for users to add notification roles to a go live message.
So they don't have to manually get the ID and paste it see #11

Consider using adding /command support to provide role opt in services

Extended description and links to related things

This will likely require enabling a bot.

Additional context or questions

Allow users to customise the name/image

Right now the Discord Notification forces the use of my name/service name and service logo

Allow customisation of this.

(Consider this as a paid feature?)

Add text customisation options

Add the ability to allow the streamer to change the wording/text of the message that is sent

Which would also allow usage for @here and @everyone or any role.

Consider: who is live carousel

Since the system knows who is live

Add a carousel to the bottom of the page, that users can opt in to, to display who is signed up from the userbase?

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.