Giter Site home page Giter Site logo

pantherhackers / pantherbot Goto Github PK

View Code? Open in Web Editor NEW
14.0 12.0 14.0 5.69 MB

PantherBot is a WebSocket Application that takes advantage of Slack's RTM API to interact with the channels that it is a part of.

License: Mozilla Public License 2.0

Python 100.00%
slack-team bot websocket-application

pantherbot's Introduction

PantherBot

PantherBot is a WebSocket Application that takes advantage of Slack's RTM and Web API to interact with the channels that it is a part of.

Using PantherBot

PantherBot currently has a few commands available to use. These are broken up into action commands and logging commands. All action commands are prefaced with the "!" marker (ie. !coin). Logging commands are prefaced with the "$" marker (ie. $log). Some responses are hard coded to certain phrases (ie. Hey PantherBot).

Current list of action commands:

!help
!coin
!helloworld
!fortune
!catfact
!pugbomb <int>
!taskme
!flip/!rage/!unflip <Optional:String>

Current list of logging commands:

$log <true/false> <optional: list of channels>
$admin <reconnect/update>
$calendar add ; <Title> ; <Date in format YYYY-MM-DD> ; <Start time in format HH:mm> ; <End time in format HH:mm> ; <Description> ; <Location>

To use these commands, in any channel that PantherBot is both present in and may post, start your message with one of the above commands and fill in the arguments as necessary

PantherBot also responds to a few custom messages as well, currently set to:

Hey PantherBot
PantherBot ping
rip PantherBot

As well as messaging them a custom message upon joining the Slack team.

Installing Dependencies

PantherBot requires several python libraries to function. These can be easily installed with the setup.bat or setup.sh file. setup.sh should be run with elevated privileges to ensure dependencies install correctly (this is an issue for most unless you're using a virtualenv) (sudo sh setup.sh should be good enough). Likewise, pip may request your permission or a prompt if using the setup.bat file. If it fails, try using administrative privileges.

Setting up PantherBot

PantherBot is currently relatively easy to set up in your Slack team. Follow the instructions below and it'll be up and running in no time!

  1. Install Python 2.7 if not installed previously.
  2. Run setup.bat (for Windows) or setup.sh (for macOS/Linux) to install dependencies and create the necessary folders.
  3. Go to your Slack team settings and set up a bot configuration, be sure to give it some information, including a username! Copy the API token.
  4. In the secrets folder, make a file called slack_secret.txt that contains only your API token.
  5. Depending on your OS, run either start.bat (Windows) or start.sh (macOS and Linux).
  6. The bot should become active in the slack team. Invite the bot into the channels you would like it to monitor (using the /invite @username command), and off it goes surveying the world!
  7. If there are errors, consider re-running setup.bat or setup.sh in a higher privileged environment to be sure everything is installed properly.
  8. The bot is set up. If you want to edit anything (like the posting name or icon), edit the config folder files to edit things such as:
  • BOT_NAME, BOT_ICON_URL (in bot.txt)
  • SLACK, GOOGLECAL, LOGGING, GOOGLECALSECRET, NEWUSERGREETING, GREETING (in settings.txt)
  • ADMIN (in admin.txt)

pantherbot's People

Contributors

arshbot avatar bcabio avatar ferrerluis avatar litagano-m avatar ngbrown11 avatar nishnha avatar

Stargazers

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

Watchers

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

pantherbot's Issues

Welcome message returns 'true'

The welcome message when a member joins returns 'true' for some reason via slackbot. This needs to return the contents of a specific file. @braxton-mclean knows more about where to pull the contents from.

Add .env file

Use .env file rather than having to directly edit one's own system environment variables

Move all credentials to db and have pbot pull creds from there

Currently all creds are pulled from env variables/files on the instance running pantherbot. This should be changed. Pantherbot should only need to pull one set of creds for the DB, connect to the db, and pull all creds needed from there.

  • Create DB table
  • Load Creds into DB (This needs to be done by an admin)
  • Pull Necessary Creds from DB
  • Have DB creds pulled from env variable
  • Set DB cred env variable in aws (this needs to be done by @mhijazi1)

Set up proactive timing system

Likely need to have a separate script running in tandem or a thread that is in charge of handling timed events, such as continuous reminders or channel posts.

Dice Command

Description

Roll dice of your choosing

Commands

!dice - Roll x number of six sided
!dice Roll x number of y sided dice

Thoughts?

Command for getting Stock Information

Get stock information by stock acronym

Maybe get the info for the past day, month, 3 months, year, etc.

!stock <acronym> <timespan>

Example:

!stock GOOGL 1m
!stock GE 1d
!stock TSLA 3m

Cutebomb

Cutebomb that pulls data from /r/aww or /r/puppies or something!

Convert to Python 3

The main reason pbot was python 2 was due to an incompatibility with the slackclient package. This has been resolved, convert to python 3.

This blocks all future dev work and should be done first.

Log member joining.

Since Slack does not give us a way to retroactively see member join dates, it would be beneficial to keep a small logging that we can check up on.

Command aliases

Feature: allow aliases to be created for commands

For example...

@arshbot : Mo disagrees stating that it does not allow the code to be readable (pb structure demands that the name of a script dictates the command name) and instead wants the file to be generate_report.py which means the command name would be generate_report

It would be nice if "generate_report" could be the script name (and the original command name) and then an alias for power users to use, say, "g_r" or "gr" could be dynamically created to point to generate_report.

Update the welcome message feature

Create a command that updates the env variable WELCOME_MESSAGE to store a welcome message that will be sent whenever a new user joins. Currently this feature exists but draws from a .txt file. We need to change it to draw from an env variable and have the capability to update the WELCOME_MESSAGE

Make polls easier and less clutter-y to set up

Currently, setting up a poll requires a lot of messages in the channel where the poll is created. This is problematic because it sends users useless notifications and clutters up the channel history.

One solution would be to have poll creators interact with PantherBot via PM and then PantherBot could post only the finalized poll message to the channel.

Ambush someone

Description

Send messages to users the next time they speak

Command

!ambush < user >: < message >

Thoughts?

MARTA Integration

Description

Another function !marta where you can ask for the next trains coming to a station.

Usage

!marta <train_station> <south|north|east|west>

Response

The response could look somewhat like this (this is what our bot at work says)
marta_response

PantherBot #council-pf-ph friendliness

As per the rules of council:

council-of-ph:

To post –

  • Things that affect other committees, especially finalized information.
  • Discussion (or something that is meant to spark discussion) that is informative and helpful for committee functions or things that affect PH as a whole.

Not to post –

  • Shitposts, one-liner questions, or information that does not only apply to council members
  • Snarky, aggressive, or pointed comments
  • Replies to topics outside of threads. Keep discussion in the related thread.

Guidelines for posts –

  • Avoid multi-comment messages. You can refrain from pressing the enter key for a few seconds while you finish your writeup. If it is urgent enough to require multiple messages it is likely already something being discussed and should instead go in the related thread, or it can be posted elsewhere. Inside your comment’s threads you can talk how you like.
  • Be as detailed as possible if you’re describing an issue that needs discussion. The more context the better. If something has reached a conclusion, follow up with a second comment describing the outcome.

The recent experience with PantherBot in council has taught a lesson. For all PantherBot functions allowed in council, please follow these rules from now on.

PantherBot needs to be more #council friendly

As per the rules of council:

council-of-ph:

To post –

  • Things that affect other committees, especially finalized information.
  • Discussion (or something that is meant to spark discussion) that is informative and helpful for committee functions or things that affect PH as a whole.

Not to post –

  • Shitposts, one-liner questions, or information that does not only apply to council members
  • Snarky, aggressive, or pointed comments
  • Replies to topics outside of threads. Keep discussion in the related thread.

Guidelines for posts –

  • Avoid multi-comment messages. You can refrain from pressing the enter key for a few seconds while you finish your writeup. If it is urgent enough to require multiple messages it is likely already something being discussed and should instead go in the related thread, or it can be posted elsewhere. Inside your comment’s threads you can talk how you like.
  • Be as detailed as possible if you’re describing an issue that needs discussion. The more context the better. If something has reached a conclusion, follow up with a second comment describing the outcome.

The recent experience with PantherBot in council has taught a lesson. For all PantherBot functions allowed in council, please follow these rules from now on.

$ at start of line triggers admin call

Whenever a user has a message beginning with $('$10 ought to do it', '$$$ Money!'), PantherBot takes the rest of the line as an admin call which will triggers this erroneous message

It seems you aren't authorized to use admin commands. If you believe this a mistake, contact the maintainer(s) of PantherBot

Solution

Mimick the solution for the similar ! solution. Check to see if the line is long and if the next few tokens aren't $

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.