Giter Club home page Giter Club logo

snowball's Introduction

WARNING: This repository is unmaintained, it worked last time I was running it though. If it works for you, then yay! If it doesn't I won't really be able to help you out, I have far too much to do when I'm not at work these days. You're free to do whatever you want with the code, but I won't be able to support you. Good luck!

Snowball

A voice activated bot that sits in a Discord server and joins audio channels with users.

Note: Most free and easy to use music bots will ignore commands from other bots, if not all of them. I host my own MusicBot which works great.

Example

This would take place entirely over voice, I'd just join a voice channel and Snowball would turn up.

Olical: Hey Snowball

Snowball: Hey Olical

Olical: Move everyone to my channel

Snowball: You got it.

[everyone is moved to my channel]

Olical: Hey Snowball

Snowball: Hey Olical

Olical: Play Darude Sandstorm 10 hours bass boosted

Snowball: Sure

[beautiful music starts playing]

Key features

  • Control your music: play hurricane highlife, turn the volume down.
  • Move users around: move me to channel 2, move everyone to my channel, move Olical and Photan to channel 1.
  • Minimal required configuration.
  • Woken by "hey snowball", uses very little CPU.
  • Automatic joining and leaving of channels as users join, move and leave.
  • Easily runnable Docker container.

Technology used

I wrote about how I got Porcupine working in Clojure in my post: Wake word detection with Clojure (or Java).

Running

You can run Snowball in two ways: Directly through the Clojure CLI or by running the pre-built Docker container. Before you start the application you need to create config/config.edn (which is merged on top of config.base.edn) and config/google.json which you can get from a service account in GCP.

Once you have your Google Cloud Platform account up and running you need to ensure the following services are activated for your account:

You can also optionally activate Cloud Storage and create a bucket that will be used for caching text to speech audio results.

Here's an example config.edn but you should be able to work this out yourself from the nil values in config.base.edn.

{:discord {:token "dkjdfd-my-discord-token-djslksdj"}        ;; This is the only required value.
 :speech {:cache {:bucket "your-speech-cache-bucket-name"}}
 :presence {:whitelist #{492031893908249384}}
 :command {:music {:channel 127661586692963623
                   :user 892362784653922700}}}

The presence whitelist and blacklist allow you to restrict what channels Snowball will join. The music and speech cache keys are completely optional, the only essential configuration is the discord token.

Clojure

Once you have the CLI installed (it's available in most package managers) you can simply execute make to build and run the entire application. The first run will take a while because it has to download the Porcupine repository which is fairly large. Make sure you have the core C build tools installed, a very small library is compiled for linking the JVM into Porcupine.

Docker

If you know how to use Docker this'll be really straightforward, if you don't, go learn how to use Docker first. The tag in this block is the currently recommended version.

docker run -ti --rm -v $(pwd)/config:/usr/snowball/config olical/snowball:2df16192172f5b7b645939fe0c1b09a38c442b4b

I run my instance on a Kubernetes cluster I created within GCP, I noted the steps I took in KUBE_NOTES.md which may help others get their own instances running cheaply.

Commands

To give a command you need to say "hey snowball" and wait for acknowledgement, Snowball will say "hey [your name]" when it's ready. Then you can issue one of these commands. The matching is performed via regular expressions (snowball.command) so you can use any sentence you want as long as the key words are present.

  • "say ..." - Repeats back to you whatever came after "say".
  • "ignore me", "nevermind", "go away" etc - Sends Snowball back to sleep if it was woken accidentally.
  • "who's a good boy?" - Confirms that Snowball, is indeed, a good boy.
  • "play ..." - Sends the !play command to the music bot with the song name that came after "play".
  • "volume" - Any sentence with volume in it triggers volume modification.
    • Including "increase", "up" or "raise" will raise the volume.
    • Including "decrease", "down" or "lower" will lower the volume.
    • Including a number will set the volume to that value.
    • Including an up / down word as well as a number will modify the volume by that amount.
      • "turn the volume up"
      • "lower the volume by 30"
      • "set the volume to 20"
  • "move" - Any sentence with move in it triggers channel movement.
    • You need to provide some users to move and a channel to move them to.
    • Usernames or "me", "myself" or "everyone" can be used to select people.
    • A channel name, "this channel", "my channel", "our channel" or "here" can be used to select a channel.
      • "move everyone to this channel"
      • "move me to channel 2"
      • "could you move Photan to the naughty corner"

There's a few more very obvious music bot commands.

  • pause / stop
  • resume / unpause
  • skip
  • summon
  • dismiss
  • clear

Issues

If something isn't working quite right and there isn't an existing similar issue, please feel free to raise one with as mush information as you can provide. Logs, versions and system information all help.

Contributions are entirely welcome but also feel free to fork and modify this project to suit your needs. Not every change needs to go into this repository, especially if you want to add meme commands that maybe only your Discord will appreciate.

Author

Built by Oliver Caldwell (@OliverCaldwell). Feel free to message me if you've got any feedback or questions.

Unlicenced

Find the full unlicense in the UNLICENSE file, but here's a snippet.

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Do what you want. Learn as much as you can. Unlicense more software.

snowball's People

Contributors

olical avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

snowball's Issues

Bot not responding to wake up command

Hello again, I've already created a service account credential with cloud speech and text-to-speech api access and saved it in config folder as google.json. I get the bot to join my server and channels but it's not responding to voice commands. I don't see any activity in google dashboards either. ๐Ÿค”

PS D:\repos\bot> docker run -ti --rm -v ${PWD}/config:/usr/snowball/config olical/snowball:latest
18-10-03 19:29:52 5e280cd55d2f INFO [snowball.main:10] - Starting nREPL server on port 9045
18-10-03 19:29:52 5e280cd55d2f INFO [snowball.main:15] - Starting components...
18-10-03 19:29:53 5e280cd55d2f INFO [snowball.config:16] - Loading base config from config.base.edn and user config from config/config.edn
18-10-03 19:29:53 5e280cd55d2f INFO [snowball.discord:150] - Connecting to Discord
Discord4J: ERROR INITIALIZING LOGGER!
Discord4J: No SLF4J implementation found, reverting to the internal implementation (sx.blah.discord.Discord4J$Discord4JLogger)
Discord4J: It is *highly* recommended to use a fully featured implementation like logback!
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
19:29:53.924: [INFO][main][sx.blah.discord.Discord4J] - Discord4J v2.10.1 9b1c81a (https://github.com/austinv11/Discord4J)
19:29:53.926: [INFO][main][sx.blah.discord.Discord4J] - A Java binding for the official Discord API, forked from the inactive https://github.com/nerd/Discord4J. Copyright (c) 2017, Licensed under GNU LGPLv3
18-10-03 19:29:54 5e280cd55d2f INFO [snowball.discord:31] - Connected, waiting until ready
18-10-03 19:29:54 5e280cd55d2f INFO [snowball.discord:32] - Not ready, sleeping for 1000ms
19:29:55.295: [INFO][HttpClient@1894307438-19][sx.blah.discord.Discord4J] - Websocket Connected.
19:29:55.570: [INFO][Dispatch Handler][sx.blah.discord.Discord4J] - Connected to Discord Gateway v6. Receiving 1 guilds.
18-10-03 19:29:55 5e280cd55d2f INFO [snowball.discord:33] - Ready
18-10-03 19:29:55 5e280cd55d2f INFO [snowball.discord:172] - Starting audio channel from subscription
18-10-03 19:29:55 5e280cd55d2f INFO [snowball.comprehension:20] - Starting phrase channel
18-10-03 19:29:55 5e280cd55d2f INFO [snowball.speech:56] - Starting up speech client
18-10-03 19:29:56 5e280cd55d2f INFO [snowball.comprehension:108] - Starting speech to text systems
18-10-03 19:29:56 5e280cd55d2f INFO [snowball.comprehension:181] - Porcupine frame length is 512 samples and the sample rate is 16KHz, as expected
18-10-03 19:29:56 5e280cd55d2f INFO [snowball.command:139] - Starting command dispatcher loop
18-10-03 19:29:56 5e280cd55d2f INFO [snowball.presence:17] - Starting presence poller
18-10-03 19:29:56 5e280cd55d2f INFO [snowball.main:23] - Everything's up and running!
18-10-03 19:29:56 5e280cd55d2f INFO [snowball.discord:137] - Audio manager exists, subscribing to audio

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.