Git Product home page Git Product logo

nillagoober's Introduction

NillaGoober build

nillagoober_tv is a Go project running in Azure that serves as nillagoober's personal hype-man. It's purpose is to post to social media when nillagoober goes live on Twitch and generally promote the streamer at least once a day. It currently is being purposed as a bot on Discord, but will branch to also use social media as a platform for promotion in the near future.

Getting Started

Discord bot command list

All commands in this list are to be preceeded by !!. At some point I'd like to have this to be paramaterized so it can be customized.

  • help - Prints a message directing a user to this GitHub project for command references.
  • pepega - Prints pepega clap to a Discord channel. Good for Chiddy.
  • viewers - This command interacts with the Twitch API to gather the amount of current viewers watching the stream, and sends the number to a Discord channel. Note: This command will crash the bot if the stream isn't running. Working on better handling of the Twitch HTTP response.

Lots more coming soon.

How to provision the infrastructure in Azure with Terraform

In a real world scenario, I'm running this project in Azure, provisioning a single server instance with Terraform. This is obviously not required, but if running like I'm running it is desired, then follow the steps in this section.

Prerequisites

  • Terraform is installed
  • Azure cloud shell is installed
  • An Azure account (you need to put a subscription ID from your account in main.tf)

Execution

After cloning this repository to your system (make sure you are logged into your Azure account with az login before attempting):

  • In this repo's directory on your system, run terraform init. This command will create a .terraform directory using context from the main.tf file and store information such as plugins.
  • Next, run terraform plan. This will prompt Terraform to create and show you what it intends to do on the Azure side to provision your infrasture. You can optionally save this plan to a file using the -out flag.
  • Once a plan is generated by Terraform, all that is left is to apply it which actually executes the generated plan from the previous step. terraform apply will provision the infrastructure as it has presented it to you. Optionally set -auto-approve to not have to answer yes at the prompt.

At this point, Terraform has created everything up to and including a virtual machine. What's next is getting go installed and configured for the project to run successfully.

Installing and setting up the go project

Since I have Azure setup to install Ubuntu as the OS on my VM that will host the project, I will only be covering install and configuring go on Ubuntu systems. If you are using a different distribution of Linux, please see this page.

Execution

  • Install go by running sudo apt install golang-go -y.

  • For Go to work properly, one must set the go executable path:

    export PATH=$PATH:/usr/local/go/bin

    This can either be run as a separate command, though it won't be persistent across sessions, or it can be added to your ~/.profile for persistency. Test the go installation with go version. If the system complains about not having a proper path set, see this document.

  • Now that go is installed and configured for execution, run go get github.com/serverislife/nillagoober to have go pull this repository and put it in your $GOPATH.

  • Navigate to the newly pulled project in your $GOPATH. This directory should be $GOPATH/src/github.com/serverislife/nillagoober.

  • Compile an executable by running go build. This will create an executable in the project directory with the same name as the project itself, nillagoober.

  • At this point, all that is left is to run the bot. nillagoober -t <token>. The -t flag allows you to pass a Discord bot token as an argument to the command. This means that to run this bot, you will need to have registered a bot with discord, given it permissions, and invited it to your server (see the TODO section for more details).

Useful links

TODO

  • Write more Twitch interactive functions
  • Update README with Go information
  • Parameterize input in main.tf
  • Write documentation on how to simply invite the bot and have it run from my infrastructure (so no go or Azure knowledge is required).
  • Write section on how to create a Discord bot/get bot token.

Contact

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.