Coder Social home page Coder Social logo

nathos / gitterbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from satelliteworkshops/gitterbot

0.0 2.0 0.0 13.15 MB

Chatbot for GitHub Satellite Workshops - Forked from dcscan/gitterbot

Home Page: https://gitter.im/dcsan/gitterbot

JavaScript 93.16% Shell 3.35% CSS 0.19% HTML 3.30%

gitterbot's Introduction

This project is a fork from dcscan/gitterbot, with changes made for GitHub Teacher

Build a Bot Workshop

In this 40 minute session, you'll fork an existing chatbot and get it up and running within minutes. But, this is more than just a glorified demo.

In addition to a functional chat bot, you'll walk away with detailed playbooks of advanced chatops functionality so you can implement the chat bot in your own chat environment.

bearbot

Times:

  • 9:30-10:30
  • 10:45-11:45
  • 13:00-14:00
  • 14:15-15:15 Planner: @migarjo & @brianamarie Facilitator: @mimgarjo & @brianamarie

Prerequisites

Tools

Tool Used for
GitHub (Please log in now) To grab the code
Glitch (Please login with GitHub now) A temporary server for your chat bot
Gitter room (Please join room now, authenticate with GitHub) To interact with your chatbot
One shared bot user account The account logged in to Gitter, authenticated via Glitch app, responding to messages ๐Ÿค–

Part 1: Steps for Getting Started

  1. Fork the satelliteworkshops/gitterbot repository
  2. In Glitch, import your fork of the githubteacher/gitterbot repository
  • Click 'Edit Code'
  • Click the title of the app on the top left
  • Select 'Advanced Options'
  • By 'Import from GitHub', click 'Grant Access' and allow the app the proper permissions
  • Select 'Import from GitHub' and type the name of your fork, USERNAME/gitterbot
  • Note: Any changes made in Glitch will not automatically be made in your fork. The steps are similar to importing, but instead select 'Export to GitHub'.
  1. In Glitch, replace the contents of the .env file with:
SERVER_ENV=demobot
GITTER_USER_TOKEN=92123753cc1ec6e60bd0ca3e7b87b35bc38ca4d3
FCC_API_KEY=TESTAPIKEY
GITTER_APP_KEY=63ece8ac0eeed9b17b1cc9867f65d4857ec6e5fc
GITTER_APP_SECRET=9026e3b3a74357035ee15a9591f31b2de5cfd3a6
GITTER_APP_REDIRECT_URL=http://localhost:7891/login/callback
LOG_LEVEL=10
PORT=7891
  1. Join the shared gitter chat room. (You will need a Gitter account, which you can create with your GitHub account). You can test this by saying something that the bot is already looking for, like "satellite".

Part 2: Pick Your Own Adventure

Mix and match from the following activities. It doesn't matter if you do none of them or all of them, or what order you do them in. Each activity is independant of the others and is a way to fill out functionality of the bot for your specific use. If you don't have time to get to everything today, don't worry! You still have all of the instructions on your fork.

Add new bot messages

  • PROTIP/Disclaimer: Do not include the phrase that triggers a message in the response message. You will find unfortunate behaviors, which may include some accidental looping that may get the bot account banned. I may or may not know from experience.
  1. Find the existing message code
  • The basic room messages are stored in data/rooms/RoomMessages.js.
  • So far, our bot is best at watching for incoming chat messages, and uses regex to know when to respond.
  • Test out the current messages (and your regex knowledge) to see what our Bot can say:
    • /satellite/gim
    • /githubteacher/gim
    • /botx/i
    • /\btroll\b/i
    • /allyourbase/
  • It's easy to add simple, static messages here. This is the point of contact for more interactive messages, too.
  1. Add a new message and trigger that will be unique to your bot.
  • If we all write a message for the same trigger, and try that trigger in the chat room, every bot will respond.
  • Change line 23, replacing USERNAME with your own username.
  • Change the response to be whatever you'd like, maybe something like "I heard they're the best tennis player in the country."...or something more true, perhaps.
  1. Refresh the server
  • This change doesn't automatically restart the server. To do so:
    • Go back to the .env file
    • Add an empty line break at the end of the file
  • WHY: This starts the server again, and now your message will be reachable by the bot
  • Test this out in the shared chat room.

Get your own bot instead of our default bot

  • Create a GitHub account for the new bot.
  • Sign that account into Gitter and join whichever chat rooms you'd like it to be active in.
  • Go to https://developer.gitter.im/docs/welcome and click "Sign in". You'll be given a new API token.
  • Replace the GITTER_USER_TOKEN of the .env file with this new token.

Change the chatroom for the bot

Note: This will only work if you've created your own bot account.

  • Change code in data/RoomData.js
  • The code that tells the bot to join our chat room is on line 39.
    demobot: [{
        title: "githubteacher's GitterBot room",
        name: "githubteachergitterbot/lobby",
        icon: "star",
        topics: ["getting started"]
    }],
  • Change the code there, or add your code to the block in lines 24-32.
  • Join the new room manually while logged in as your bot account.

Make the bot persistant with a Heroku Server

  • Make a Heroku account and log in
  • Create a project from the same existing fork
  • In app.js, comment out line 7: require('dotenv').config({path: '.env'});
  • In Heroku under settings, choose a buildpack of heroku/nodejs
  • Also in settings, add config variables to equal those that were in your .env file on GoMix.
  • Deploy the app.

Connect the bot to a repository's GitHub wiki

  • This is done using submodules and scripts. The submodules are not included in this repository, but the scripts and directions are.
  • The Bot functionality for calling wiki pages in this format already built in
  • To connect your own wiki, add the repository with said wiki as a submodule of this repository.
  • Use the script in bin/wiki-update.sh to update the file structure of this repository. This script will require updating based on your submodule's name and placement within your local repository.
  • Files will be added to match a structure like data/wiki/ARTICLE.md, and the bot already knows to search those files with the wiki message.

๐Ÿšง WIP ๐Ÿšง Give the bot some persistent data, like .rem things

? Maybe adapter that would interact with database, and have existing database set up for this example, with instructions on how to change the database and interactions

๐Ÿšง WIP ๐Ÿšง API adapter

? Adapter that would abstract away steps of API, user would just pick API and what strings to search for it

๐Ÿšง WIP ๐Ÿšง Longer strings of conversation, remembering past user things

?

๐Ÿšง WIP ๐Ÿšง Have the bot work in Slack instead of Gitter (Or...dream big...why not also integrate to Facebook or any other messaging platform?)

? Have functionality for both, put the functional chat code in a place that could be accessed by the slack or gitter code

Part 3: Dream Big for Your Bot

Chatbot functionality is limited only by imagination. What are some dreams for chatbots? What are some cool functionalities we could show or feature without delving into 'how'? You can sort your dreams for your bot into 3 general tiers. Here are some of our ideas:

Tier 1: Static interaction

  • When I say "hey", the bot says "ho!"
  • Meeting reminders (with links to the calls!)
  • FAQ ready to go

Tier 2: User inputs something, bot searches static information to give specific information

  • Get the weather at a designated location
  • Get the location of a specific user
  • .gif display, llike /giphy chatbot

Tier 3: User orders bot to do something, bot actually makes a change to something

  • Onboarding
  • Deploy
  • Social conventions, like thanking others by giving them sparkles
  • Scheduling bot

gitterbot's People

Contributors

abhisekp avatar benmcmahon100 avatar brianamarie avatar darthmeme avatar dcsan avatar dting avatar githubteacher avatar irinatag avatar kirah1314 avatar oab00 avatar opatel99 avatar saintpeter avatar

Watchers

 avatar  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.