GithubHelp home page GithubHelp logo

hypebot's Introduction

HypeBot

HypeBot is the perfect way to add more #Hype to your chat application. Simply add this bot to get #Hype.

Development Guide

Want to increase #HypeQuality? Join https://discord.gg/QZmQd5m to get started.

Running the Bot

Use bazel for building all the things. Installation instructions.

bazel build hypebot:lolbot.par --python_path=python3
./bazel-bin/hypebot/lolbot.par \
    --params='{
        "interface": {"token": "[DISCORD_TOKEN]"},
        "riot": {"api_key": "[RIOT_KEY]"},
        "commands": {"WeatherCommand": {"apixu_key": [APIXU_KEY]}
    }'

Discord

Discord is our primary chat application interface. Create an application with Discord. Once the application is created, click "Create A Bot User" to get a Discord Token. You then need admin privileges on a server and select "Generate OAuth2 URL" to invite the bot to your server.

Weather Key

HypeBot gets its weather from www.apixu.com. Sign up to get your key.

Storage

By default, HypeBot looks for a Redis server running on localhost at the default port 6379. You can pass overrides in --params to use a different location.

Riot

To integrate with the Riot API, you need to create an application in order to get an API Key.

Type Annotations

HypeBot is joining the 21st century and attempting to use a new fancy type annotation or hinting library to reduce the number of bugs that careless humans introduce into the otherwise spotless codebase. As you modify existing code or add new functionality, please use typing. Since we only support python3, this can be done in two easy steps.

  1. Add the relevant imports from the typing module into your python file depending on the types used in your code.

    from typing import Any, Callable
    
  2. Add type annotations to your function definitions. As an example:

    def DisableSkynet(requesting_user, confirmation_id,
                      post_disable_fn, are_you_really_sure=False):
      ...
    
    # This turns into...
    
    def DisableSkynet(requesting_user: str, confirmation_id: int,
                      post_disable_fn: Callable[..., None]
                      are_you_really_sure: bool = False) -> None:
      ...
    

    Note: The ellipse inside Callable mean that post_disable_fn can take any number of arguments. If you want to annotate the function's arguments, use the Callable[[int, str], None] format.

A few "best" practices:

  • Annotating public methods is strongly encouraged
  • Annotating private methods is optional, but encouraged where it helps readability
  • Complex types (particularly ones from outside hypebot) can be omitted or replaced with Any
  • For any other questions, refer to PEP484.

What about HypeParams?

Because of how HypeParams operates (specifically, creating attributes dynamically from the initialization dict), typing can't provide useful type-checking to these objects. If you need to annotate a HypeParams instance, just use Any as per the best practices above.

Legal

Hypebot is not an official Google product.

hypebot's People

Contributors

vilhelm avatar brcooley avatar jellzilla 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.