Giter Site home page Giter Site logo

hostbot's Introduction

Note: This project is no longer being maintained.

Hostbot

This is a simple hostbot that will automatically host a list of given channels, sorted by their priorities, when they go online. It will keep hosting a channel until it goes offline and then re-host a new channel afterwards.

Features

  • Continuous hosting of channels per the priority list. Once a channel goes offline, it will automatically attempt to find a new live channel to host following the priorities in the priority list.
    • Due to the Twitch API sometimes being a bit slow on updating "live" status of a stream, the automatic rehost will trigger 15 seconds after a host has ended due to the channel going offline.
  • Priority levels go from highest number to lowest. If no priority is specified when a channel is added, then the priority will be 0.
  • Each priority level can contain either one or multiple channels.
    • If the highest priority level with live channels have multiple channels currently live, it will pick a random live channel from the specific priority level.

Commands

Commands, by default, all require the users that wish to use it to be an 'admin'. Admins are specified in the config.admins array.

The format of commands will be <required parameter> and [optional parameter]. The rest are static keywords.

  • !addstreamer <channel name> [priority] - Adds a streamer to the list of channels to be hosted. [priority] can be any number, but if it's not specified it defaults to 0.
    • If a streamer is already added, this will update their priority.
  • !removestreamer <channel name> - Removes a streamer from the list of channels to be hosted.
  • !listpriorities <priority> - Lists what channels are listed under <priority>, if any.
  • !host - Hosts a new channel by sorting through the priorities, regardless if any channel is being hosted or not.
  • !rehost - An alias of !host.
  • !unhost - Unhosts the current channel.
    • NOTE: Due to the way the bot detects unhosting of channels, this will automatically trigger a rehost if a prioritized channel is live. This is only really useful if you've removed a streamer from the priority list and wish to unhost when no one else is live on the priority list.
  • !status - Replies with who is currently being hosted, if anyone.
  • !quit - WARNING: This will quit the application completely and requires it to be restarted for commands/hosting to function if used.

Installation

  • Install node and npm
  • Install dependencies using npm install in the directory of the project.
  • Rename config.sample.js to config.js and edit the info of config.js
  • Launch bot with node app.js

License

MIT License

Notes

  • The channel used for hosting is always the first index in config.tmi.channels. This way you can specify which channel to host with, but still allow use of commands in different channels.
    • If no channels are specified in config.tmi.channels then it will default back to the username. This channel will also be automatically joined on startup if no other channels are specified in config.tmi.channels.

Changelog

Version 0.1.1:

  • Hotfix for crash when the bot attempts to check hosts.

Version 0.1.0:

  • Modified how hosts are retrieved.
  • Added workaround for host notifications not properly working.

Version 0.0.2.1:

  • Automatic rehosting's delay has been updated from 15 seconds to 120 seconds (2 minutes), as the Twitch API seems extremely slow when it comes to updating at times.

Version 0.0.2:

  • Automatic rehosting when the channel that was hosted goes offline is now delayed with 15 seconds, due to the fact the Twitch API isn't instant on updating live status.

Version 0.0.1:

  • Initial release.

hostbot's People

Contributors

decicus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hostbot's Issues

Unhosting when channel goes offline [Workaround]

Lately (shortly after everyone was migrated to AWS) Twitch hasn't been sending the unhost notifications when a channel goes offline (although the unhost itself still triggers), which essentially breaks the main purpose of the bot.

The workaround is to use the unofficial hosts endpoint (https://tmi.twitch.tv/hosts?include_logins=1&host={USER_ID}) to detect unhosts, instead of using chat notifications.

Until this is fixed, it's possible to manually use the !rehost/!host or !unhost commands, as the "Exited host mode" chat notifications are still sent.

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.