Code Monkey home page Code Monkey logo

apexnightbot's Introduction

Apex Legends nightbot

Apex Legends chat command for any Twitch.tv bot that has a an URI fetch command system.

Works with: Nightbot, Ankhbot, Deepbot, Phantombot and probably more unknown.

Apex Legends Twitch streamers, this is a PHP script that uses the API statistics and gathers end-points of the Apex Legends Rank stats and forwards them to Nightbot.

This server-side script is making use of Nightbot's dynamic response system (mostly $(urlfetch)) with which you are able to fetch the resources forwarded by my Heroku App.

Do not worry! Nothing is saved server-side.

How to add commands to Nightbot

With chat:
"!commands add !command_name command_response"
With interface:
https://beta.nightbot.tv/commands/custom

Here's what the response should contain for Nightbot to reply with your current rank:

$(urlfetch http://yourservername.herokuapp.com/apexstats.php?platform=YourPlatformHere&nick=YourNickHere&command=rank)
  • Adjust the URL parameters to fit your purposes.

  • ?platform= (xbl, psn or origin.)
    xbl for Xbox One,
    psn for PS4,
    origin for PC.

  • &nick= (Your username on the specific platform.)

  • Specify a command after the &command= query parameter at the end of the URL in the $(urlfetch) method.
    In the example above I specified "rank" as for the current rank in the current season.

Note:

  • You CAN write custom text before and after $(urlfetch) in the response!
  • Do NOT forget to close any opening parantheses '(' with a closing ')' at the end!
  • You can let the user search for a player himself by doing ?platform=$(1)&nick=$(2). The user will have to put a platform and a nick as arguments separated by a space after your command.

Deployment to Heroku

replace $apikey = ''; in apexstats.php your api key. GET API KEY HERE

$ git init
$ git add -A
$ git commit -m "Initial commit"

$ heroku create
$ git push heroku master

$ heroku run python manage.py migrate

See also, a ready-made application, ready to deploy.

or fork this repo and press

Deploy to Heroku

Credit

Giuthub https://github.com/HugoDerave/ApexLegendsAPI

Discord https://discord.gg/TZ4Y9EB

apexnightbot's People

Contributors

axsddlr avatar

Watchers

James Cloos 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.