Code Monkey home page Code Monkey logo

dark-offelsalat's Introduction

Dark Offelsalat

Dark Offelsalat is a silly project of mine... It all started as a joke during a twitch stream. After clipping a rather funny moment of the stream, the idea of creating a bot that will present the clip to anyone joining the stream came to me. The streamer wasn't against it, in fact he challenged me to do it before the end of the stream... Which obviously I did. I mean... I had to !

I wasn't happy with the 1st version, so I made this one.

The name also comes from a joke... It's supposed to be the dark side of Kart Offelsalat. Kart Offelsalat is one of my prank names that translates to "Potato salad" in german.

On a more serious note, this bot can be useful. It can post predefined messages when a chatter uses a given word. It can also fetch the most recent video from a YouTube channel and include it in the message.

The docker images can be used on amd64 and arm64 systems.

Starting the bot

You can run this bot using docker CLI, docker-compose or running it directly on the host machine.

Parameters

The various arguments the bots takes can be set using a command line flag or using an environment variable : If the same option is set using both the command flag and the environment variable, the environment variable will be ignored.

CLI argument Environment variable Description Required Default
--log-level LOG_LEVEL The log level of the bot. The bot will never log the content of the received message or its author No INFO
--twitch-token TWITCH_TOKEN The twitch.tv token used to authenticate Yes
--youtube-token YOUTUBE_TOKEN The YouTube API token for fetching the latest video No
--youtube-playlist YOUTUBE_PLAYLIST The YouTube playlist ID used to fetch the latest video No
--channel CHANNEL The twitch channel that the bot will be chatting on Yes
--message MESSAGE The message that will be sent by the bot. Can include {{url}} that will be replaced by the url to the latest video No
--timeout TIMEOUT The delay between each message send by the bot in seconds Yes 300 (5 minutes)
[args...] The list of words that will trigger a bot response Yes

Docker CLI

docker run \
  -d \
  --name darkoffelsalat \
  --restart unless-stopped \
  -e LOG_LEVEL=INFO \
  -e TWITCH_TOKEN=yourtwitchtoken \
  -e CHANNEL=twitchchannel \
  -e MESSAGE=The\ message\ to\ send\ including\ a\ {{url}} \
  -e TIMEOUT=300 \
  -e YOUTUBE_TOKEN=youtubetoken \
  -e YOUTUBE_PLAYLIST=yourplaylistid \
  ghcr.io/renaud11232/darkoffelsalat \
  some example words

Docker-compose

docker-compose.yml:

version: "3"
services:
  darkoffelsalat:
    container_name: darkoffelsalat
    image: "ghcr.io/renaud11232/darkoffelsalat"
    environment:
      LOG_LEVEL: INFO
      TWITCH_TOKEN: yourtwitchtoken
      CHANNEL: twitchchannel
      MESSAGE: The message to send including a {{url}}
      TIMEOUT: 300
      YOUTUBE_TOKEN: youtubetoken
      YOUTUBE_PLAYLIST: yourplaylistid
    command:
      - some
      - example
      - words
    restart: unless-stopped
docker-compose up -d

Bare metal

You can install this bot by running the following command (a venv is recommended) :

pip install "https://github.com/Renaud11232/dark-offelsalat/archive/refs/heads/master.zip"

Once it's installed you can start it either by setting the environment variables :

export LOG_LEVEL=INFO
export TWITCH_TOKEN=yourtwitchtoken
export CHANNEL=twitchchannel
export MESSAGE=The\ message\ to\ send\ including\ a\ {{url}}
export TIMEOUT=300
export YOUTUBE_TOKEN=youtubetoken
export YOUTUBE_PLAYLIST=yourplaylistid
darkoffelsalat some example words

Or by providing the correct flags :

darkoffelsalat \
  --log-level INFO \
  --twitch-token yourtwitchtoken \
  --channel twitchchannel \
  --message "The message to send including a {{url}}" \
  --timeout 300 \
  --youtube-token youtubetoken \
  --youtube-playlist yourplaylistid \
  some example words

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.