Giter Club home page Giter Club logo

plugin_twitchchatbotrenewed's Introduction

Twitch Chat Bot Renewed

Twitch Chat Bot Renewed is a plugin that will send information regarding maps, server, link to the map, personal best times and checkpoints to a database that you can access from your Stream Platform (Streamlabs, Streamelements or anything else).
You can also configure every field with custom messages.

Installation

Put the files in your OpenPlanet directory which is located here:

C:\Users\<username>\OpenplanetNext\Plugins\TwitchChatBot

So that it looks like this:

Plugins/
├─ TwitchChatBot.op

Dependency

This plugin now uses the Checkpoint Counter plugin as a dependency, thanks to Phlarx.
If you don't have this plugin, any checkpoint related commands will be disabled.

You can download the plugin here.

Settings

Parameters

You will need to register with your Ubisoft account (the same as your Trackmania account otherwise it won't work) by clicking on:
Scripts > Twitch Chat Bot > Authenticate

This will open a new browser window where you will need to log into your Ubisoft account.
Once connected, you will land on a page that will display your key.
⚠ Make sure to not lose your key!

Once you got your key, you'll need to input it on the Twitch Chat Bot Renewed settings page:
Openplanet > Settings > Twitch Chat Bot Renewed > General > Key

If everything worked, you'll see a notification telling you that you are connected. You can double-check by going into:
Scripts > Twitch Chat Bot > Active (if Active is checked then it's good)

You can change the Formatting to either Fixed or Custom.
⚠ You can only select Custom if you have filled in all the fields in the Strings tab.

List of all Fixed strings:

  • On a map: ⏩ I am currently playing {name} by {author}.
  • Not on a map: ⚠ I am currently not in a map.
  • On a server: ⏩ I am currently playing on {name} ({nbr_player}/{max_player}).
  • Not on a server: ⚠ I am currently not on a server.
  • Personal best: ⏩ My current pb is {pb}s.
  • No personal best: ⚠ I don't have a pb on that map.
  • URL: ⏩ Map URL: {TMXurl} | Map leaderboard: {TMIOurl}
  • Map not found on TMX: ⚠ Map not found on TMX.
  • Map UID not sent: ⚠ UID Not sent. (shouldn't happen unless you didn't update your plugin)
  • Checkpoint: ⏩ Current CP: {crt_cp}/{max_cp}.

Commands

You can enable or disable specific commands. Disabling a command means that the relevant information will not be sent to the server anymore.

Strings

You can configure every string that will be posted in the chat.

You will have variables available for every command:

  • Map:
    • {name} - map name
    • {author} - map author
    • {author_time} - map author time
  • Server:
    • {name} - server name
    • {nbr_player} - current player count
    • {max_player} - number of slots of the current server
  • Personal best time:
    • {pb} - personal best time
  • URL:
  • Checkpoint:
    • {crt_cp} - current CP
    • {max_cp} - number of CPs on the map

You can place these variables wherever you want inside the String fields.

Note: You can paste emojis from outside Openplanet. They will be displayed as ? but will be interpreted correctly in chat.

Usage

Once properly configured, just launch Trackmania and it should connect to the server automatically.

You become inactive once you close Trackmania or you manually uncheck the Active button.
Once you are inactive, the API will answer with either your predefined message or a fixed one:
⚠ I am not active.

Stream Platform

To use this plugin on your preferred stream platform, add a new command with the prefix that you want and add an API request to:
Nightbot:
$(urlfetch https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>)

Streamlabs Chatbot:
$readapi(https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>)

Streamlabs Cloudbot:
{readapi.https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>}

Streamelements:
${customapi.https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>}

Fossabot:
$(customapi https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>)

Deepbot:
@customapi@[https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>]

PhantomBot:
(customapi https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>)

Ohbot:
[customapi https://tm-info.digit-egifts.fr/read.php?type=<type>&username=<TM_username>&key=<private_key>]

Parameters:

  • Type
    • map
    • server
    • pb
    • url
    • cp
  • Username: Your Trackmania username
  • Private key: Your private key that has been given to you while authenticating

What's different between this plugin and my old plugin "Twitch Chat Bot"

Twitch Chat Bot was using Nsgr Twitch Base as a dependency, so it was still using the old plugin format. It was also working in a completely different way. It was connecting to the chat and was listening to any new messages, and answered as the streamer (ex: bmx22c) in the chat, instead of going through Streamlabs or something similar.
This Twitch Chat Bot Renewed is more of a bridge between a database and Streamlabs than a bot in itself.

Legal Notice

While logging in with your Ubisoft account, I will only get your Ubisoft username and account ID.
All stored keys are hashed.
If you want me to remove your data from the database, just send me a message on Discord with your Trackmania username: bmx22c#0001.

Special thanks

Thanks to PHLARX for the CP counter
Thanks to tooInfinite for the help on the Trackmania API
Thanks to Miss and the Openplanet Discord for the server information help

Contributing

Pull requests are welcome on this repo. For major changes, please open an issue first to discuss what you would like to change.

License 🏳️

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

plugin_twitchchatbotrenewed's People

Contributors

bmx22c avatar francislavoie avatar nicofilips avatar

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.