Giter VIP home page Giter VIP logo

slack-gamebot's Introduction

Slack-Gamebot

Add to Slack

Or roll your own ...

Tests Code Climate

A generic game bot for slack. Works for ping-pong (2, 4 or more players), chess, etc. Inspired by slack-pongbot, but more robust, generic and easier to improve and contribute to.

Installation

Create a new Bot Integration under services/new/bot. Note the API token. You will be able to invoke gamebot by the name you give it in the UI above.

Run SLACK_API_TOKEN=<your API token> foreman start

Production Deployment

See DEPLOYMENT

Usage

Start talking to your bot!

Commands

gamebot

Shows GameBot version and links.

gamebot hi

Politely says 'hi' back.

gamebot help

Get help.

gamebot info

Bot credits.

gamebot sucks

You can tell the bot that it sucks. But it will talk back.

gamebot register

Re-registers a user. This is automatic, but a user can unregister and come back with this command.

This command can also update a user's registration, for example after the user has been renamed. The bot notices user renames, but this may be necessary if the bot wasn't running during that operation.

gamebot register

Welcome back Victor Barna! I've updated your registration.

You can also remove yourself from the leaderboard with gamebot unregister me and re-register youself again with gamebot register. The data is not removed, but the user will no longer appear in the leaderboards and cannot participate in challenges.

gamebot challenge <opponent> ... [with <teammate> ...]

Creates a new challenge between you and an opponent.

gamebot challenge @WangHoe

Victor Barna challenged Wang Hoe to a match!

You can challenge anyone to play.

gamebot challenge @here

Victor Barna challenged anyone to a match!

You can create group challenges, too. Both sides must have the same number of players.

gamebot challenge @WangHoe @ZhangJike with @DengYaping

Victor Barna and Deng Yaping challenged Wang Hoe and Zhang Jike to a match!

gamebot challenge?

Show elo at stake for each opponent.

gamebot challenge? @WangHoe

Victor Barna challenging Wang Hoe to a match is worth 48 and 24 elo.

gamebot accept

Accept a challenge.

gamebot accept

Wang Hoe and Zhang Jike accepted Victor Barna and Deng Yaping's challenge.

gamebot lost [to <opponent> [with <teammate>]] [score ...]

Record your loss.

You cannot record a win.

Record your loss with a score, loser first.

gamebot lost 5:21

Match has been recorded! Wang Hoe crushed Victor Barna with the score of 21:5.

You can record scores for an entire match.

gamebot lost 15:21 21:17 18:21

Match has been recorded! Wang Hoe defeated Victor Barna with the scores of 21:15 17:21 21:18.

You can record scores for a match you have already lost.

gamebot lost

Match has been recorded! Wang Hoe defeated Victor Barna.

gamebot lost 15:21 21:17 18:21

Match scores have been updated! Wang Hoe defeated Victor Barna with the scores of 21:15 17:21 21:18.

You can record a loss without a challenge.

You can also record scores and record lost matches without a challenge including with multiple players.

gamebot lost to @WangHoe @ZhangJike with @DengYaping 5:21

Match has been recorded! Wang Hoe and Zhang Jike defeated Victor Barna and Deng Yaping with the score of 21:5.

gamebot draw [score ...]

Draws a challenge, records a tie. All other players will also have to draw to record a match.

gamebot draw

Match is a draw, waiting to hear from Victor Barna.

gamebot draw 2:2

Match has been recorded. Victor Barna tied with Zhang Jike with a score of 2:2.

You can also record scores and ties without a challenge.

gamebot draw to @VictorBarna

Match is a draw, waiting to hear from Victor Barna.

gamebot draw 2:2

Match is a draw! Wang Hoe tied with Victor Barna with the score of 2:2.

You can also record scores and have multiple players.

gamebot resigned [to <opponent> [with <teammate>]]

Records your resignation, which is a special kind of lost without a score.

gamebot resigned

Match has been recorded! Victor Barna resigned against Wang Hoe.

You can resign without a prior challenge.

gamebot resigned to WangHoe

Match has been recorded! Victor Barna resigned against Wang Hoe.

gamebot decline

Decline a challenge.

gamebot decline

Wang Hoe and Zhang Jike declined Victor Barna and Deng Yaping's challenge.

gamebot cancel

Cancel a challenge.

gamebot cancel

Victor Barna and Deng Yaping canceled a challenge against Wang Hoe and Zhang Jike.

gamebot taunt <opponent> [<opponent> ...]

Taunt other players.

gamebot taunt @WangHoe

Victor Barna says Wang Hoe sucks at ping pong!

gamebot leaderboard [number|infinity]

Get the leaderboard.

gamebot leaderboard

1. Victor Barna: 3 wins, 2 losses (elo: 148, lws: 5)
2. Deng Yaping: 1 win, 3 losses (elo: 24)
3. Wang Hoe: 0 wins, 1 loss (elo: -12)

The leaderboard contains players ranked by Elo, use leaderboard 10 or leaderboard infinity to see 10 players or all players, respectively. Use set leaderboard max 3 to limit the default leaderboard size to 3.

The leaderboard also shows the longest winning (lws) and losing (lls) streaks of at least 3.

In case you want to see leaderboard in reverse order (which would be totally wrong but motivational for people at the bottom of leaderboard), specify a negative number or -infinity:

gamebot leaderboard -5

1. Wang Hoe: 0 wins, 1 loss (elo: -12)
2. Deng Yaping: 1 win, 3 losses (elo: 24)
3. Victor Barna: 3 wins, 2 losses (elo: 148, lws: 5)

gamebot matches [number|infinity]

Displays top 10 match totals in the current season.

gamebot matches

Victor Barna defeated Wang Hoe 3 times
Deng Yaping defeated Victor Barna once

You can also get match totals for specific players.

gamebot matches @WangHoe

Victor Barna defeated Wang Hoe 5 times
Wang Hoe defeated Deng Yaping twice

Use matches 3 to see top 3 matches o matches inifinity to see all matches in the season.

gamebot challenges

Displays all outstanding (proposed and accepted) challenges.

gamebot rank [<player> ...]

Show the smallest range of ranks for a list of players. If no user is specified, your rank is shown.

gamebot rank @WangHoe @DengYaping

2. Deng Yaping: 1 win, 3 losses (elo: 24)
3. Wang Hoe: 0 wins, 1 loss (elo: -12)

gamebot promote <player> ...

Promotes other users to captain. Must be a captain to do that.

gamebot promote @WangHoe @DengYaping

Victor Barna promoted Wang Hoe and Deng Yaping to captain.

gamebot demote me

Demotes from captain to a normal user. Must be a captain and the team must have other captains to do this.

gamebot demote me

Victor Barna is no longer captain.

gamebot team

Display current team's info, including captains.

gamebot team

Team _China_, captains Deng Yaping and Victor Barna.

gamebot reset <team id|team name>

Reset all users and pending challenges and start a new season. Must be a captain to do this and confirm by specifying the team ID or name.

gamebot reset china

Welcome to the new season!

gamebot season

Display current season's leader and game totals.

gamebot season

Current: Deng Yaping: 1 win, 0 losses (elo: 48), 1 game, 2 players

gamebot seasons

Display current season's leader, past seasons' winners and game totals.

gamebot seasons

Current: Deng Yaping: 1 win, 0 losses (elo: 48), 1 game, 2 players
2015-07-16: Wang Hoe: 28 wins, 19 losses (elo: 214), 206 games, 25 players

gamebot unregister <player>

Captains can remove users.

gamebot unregister @WangHoe

I've removed @WangHoe from the leaderboard.

Users that have left a Slack team can be removed by omitting the @, eg. gamebot unregister WangHoe.

gamebot set nickname [name]

Sets a nickname for display purposes.

gamebot set nickname John Doe

Unset a nickname.

gamebot unset nickname

Captains can set nicknames of users by using a Slack mention.

gamebot set nickname @WangHoe John Doe

Captains can unset nicknames, too.

gamebot unset nickname @WangHoe

gamebot set gifs on|off

Enable/disable GIFs for your team.

gamebot set gifs off

GIFs for team China are off.

Using unset gifs is equivalent to set gifs off.

gamebot set leaderboard max [number|infinity]

Set and resets the leaderboard max. Default is inifinity, ie. to show the entire leaderboard.

gamebot set leaderboard max 5

The following are equivalent.

gamebot set leaderboard max 0
gamebot set leaderboard max infinity
gamebot unset leaderboard max

gamebot set elo [number]

Set and resets the base elo for new seasons. Default is 0.

gamebot set elo 1000
gamebot unset elo

gamebot set aliases <alias|none> ...

Set additional aliases for the bot. For example you could upload a custom emoji for :pong: and set an alias for it.

gamebot set aliases pp :pong:

Team China aliases are set to pp and :pong:.

Remove all aliases with unset aliases.

gamebot set api on|off

Enable/disable team data in the public API for your team and displays team API URL.

gamebot set api on

API for team China is on!
http://www.playplay.io/api/teams/57224e65bc526eac95bfe316
gamebot unset api

API for team China is off.

gamebot set unbalanced on|off

Allow unbalanced challenges with different number of opponents.

gamebot set unbalanced on

Unbalanced challenges for team China are on!

gamebot subscription

DM to show paid subscription information.

subscription

Your trial subscription expires in 13 days. Subscribe your team for $29.99 a year at ... .

Captains are able to see credit card info.

subscription

Customer since August 11, 2018.
Subscribed to Slack PlayPlay (Yearly) ($29.99), will auto-renew on August 11, 2019.
Invoice for $29.99 on August 11, 2018, paid.
On file Visa card, [email protected] ending with 4242, expires 2/2022.
Update your credit card info at ... .

gamebot unsubscribe [id]

DM to cancel auto-renew for a paid subscription.

unsubscribe

Subscribed to Slack PlayPlay (Yearly) ($29.99), will auto-renew on August 11, 2019.
Send `unsubscribe sub_DOvlBd1lETNimB` to unsubscribe.
unsubscribe sub_DOvlBd1lETNimB

Successfully canceled auto-renew for Slack PlayPlay (Yearly) ($29.99).

API

Slack-gamebot implements a Hypermedia API. Navigate to the application root to browse through available objects and methods. PlayPlay.io's Gamebot is here, you can see dblock's current ping-pong elo here.

A team captain must opt-in serving data via the API with set api on. The data served by the API includes team's Slack IDs, usernames and game stats.

We recommend HyperClient to query the API programmatically in Ruby.

Contributing

This bot is built with slack-ruby-bot-server. See CONTRIBUTING.

Copyright and License

Copyright (c) 2015-2019, Daniel Doubrovkine, Vestris LLC, Artsy and Contributors.

This project is licensed under the MIT License.

slack-gamebot's People

Contributors

andyle2010 avatar ashkan18 avatar dblock avatar dependabot[bot] avatar dsantosmerino avatar eddycurry avatar kanno41 avatar marin-hyatt avatar wrgoldstein 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  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  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  avatar  avatar

slack-gamebot's Issues

Show rank section for N players

Show the smallest range of ranks for a list of players.

  • Rank a single player: gamebot rank william
  • Rank two players: gamebot rank william dblock, as below.

screen shot 2015-05-20 at 2 01 32 pm

Support tournaments.

Tournaments are like seasons, but they are played with different rules, such as the winner moves forward, players are shuffled, etc.

Heroku: Could not detect rake tasks

remote:        Could not detect rake tasks
remote:        ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
remote:        and using the production group of your Gemfile.
remote:        rake aborted!
remote:        uninitialized constant Bundler
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/ext/module.rb:36:in `const_missing'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/Rakefile:3:in `<top (required)>'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load_rakefile'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:604:in `raw_load_rakefile'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:89:in `block in load_rakefile'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:88:in `load_rakefile'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:72:in `block in run'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
remote:        /tmp/build_375dda9038dda7a98609b7f549235601/vendor/ruby-2.0.0/lib/ruby/2.0.0/rake/application.rb:70:in `run'
remote:        vendor/ruby-2.0.0/bin/rake:41:in `<main>'

Support resigning

Resigning is a particular category of lost.

chessbot resign

X resigned in a game against Y

This counts as a defeat, and ll the code is the same, but the messaging is different and the match should be annotated as a resignation.

Expire challenges

Challenges that have not been accepted or declined should just expire.

Store match scores

First, lost could take scores in a list. We would evaluate the number of lhs wins vs. rhs wins, making sure the winner is on the right. Some ideas:

pongbot lost 21:15 14:21 8:11

> Match has been recorded, X defeated Y in a tie break. 

pongbot lost 21:15

> Match has been recorded, X defeated Y. 

pongbot lost 21:2

> Match has been recorded, X crushed Y. 

pongbot lost 21:19 19:21 11:9

> Match has been recorded, X defeated Y, who lost honorably. 

Scores could help separate players in rank.

You should be able to do a gamebot lost [score] after you've already lost, amending the score.

`register` causes SystemStackError: stack level too deep w/ MongoLab

Running on heroku with MongoLab free tier. Only thing of note here is that Netflix is behind a SAML-based-single-sign-on (SSO). However, the bot can connect to the slack service fine. hi returns fine. Once register is run, the app dumps this error:

2015-10-09T18:41:07.995217+00:00 app[web.1]: Puma starting in single mode...
2015-10-09T18:41:07.995251+00:00 app[web.1]: * Version 2.14.0 (ruby 2.2.1-p85), codename: Fuchsia Friday
2015-10-09T18:41:07.995254+00:00 app[web.1]: * Min threads: 0, max threads: 16
2015-10-09T18:41:07.995255+00:00 app[web.1]: * Environment: production
2015-10-09T18:41:09.125541+00:00 app[web.1]: * Listening on tcp://0.0.0.0:12740
2015-10-09T18:41:09.183190+00:00 app[web.1]: I, [2015-10-09T18:41:09.183027 #3]  INFO -- : Welcome 'smashbot' to the 'Netflix' team at https://netflix.slack.com/.
2015-10-09T18:41:09.129859+00:00 app[web.1]: Use Ctrl-C to stop
2015-10-09T18:41:09.637428+00:00 heroku[web.1]: State changed from starting to up
2015-10-09T18:41:09.681063+00:00 app[web.1]: I, [2015-10-09T18:41:09.680954 #3]  INFO -- : Successfully connected to https://netflix.slack.com/.
2015-10-09T18:41:30.395612+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:64:in `block (2 levels) in with'
2015-10-09T18:41:30.395616+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `handle_interrupt'
2015-10-09T18:41:30.395621+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `block in with'
2015-10-09T18:41:30.395626+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `handle_interrupt'
2015-10-09T18:41:30.395631+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `with'
2015-10-09T18:41:30.395643+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:116:in `connection'
2015-10-09T18:41:30.395644+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/operation/read.rb:52:in `block in execute'
2015-10-09T18:41:30.395647+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:608:in `[]'
2015-10-09T18:41:30.395649+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:608:in `block (3 levels) in flush'
2015-10-09T18:41:30.395654+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:607:in `map'
2015-10-09T18:41:30.395657+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:607:in `block (2 levels) in flush'
2015-10-09T18:41:30.395662+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:185:in `ensure_connected'
2015-10-09T18:41:30.395667+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:603:in `block in flush'
2015-10-09T18:41:30.395671+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:632:in `block in logging'
2015-10-09T18:41:30.393237+00:00 app[web.1]: SystemStackError: stack level too deep
*2015-10-09T18:41:30.393247+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/protocol/reply.rb:129:in `unauthorized?'*
2015-10-09T18:41:30.393249+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/operation/read.rb:51:in `block in execute'
2015-10-09T18:41:30.393251+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:608:in `[]'
2015-10-09T18:41:30.395676+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
2015-10-09T18:41:30.395681+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2015-10-09T18:41:30.395686+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
2015-10-09T18:41:30.393253+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:608:in `block (3 levels) in flush'
2015-10-09T18:41:30.393254+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:607:in `map'
2015-10-09T18:41:30.393258+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:607:in `block (2 levels) in flush'
2015-10-09T18:41:30.393260+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:185:in `ensure_connected'
2015-10-09T18:41:30.395690+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/instrumentable.rb:31:in `instrument'
2015-10-09T18:41:30.395695+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:631:in `logging'
2015-10-09T18:41:30.395700+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:602:in `flush'
2015-10-09T18:41:30.393262+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:603:in `block in flush'
2015-10-09T18:41:30.393266+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:632:in `block in logging'
2015-10-09T18:41:30.395703+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:406:in `process'
2015-10-09T18:41:30.395708+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/operation/read.rb:48:in `execute'
2015-10-09T18:41:30.395713+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/operation/read.rb:56:in `block (2 levels) in execute'
2015-10-09T18:41:30.395718+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:118:in `block in connection'
2015-10-09T18:41:30.395721+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:64:in `block (2 levels) in with'
2015-10-09T18:41:30.395726+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `handle_interrupt'
2015-10-09T18:41:30.395746+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:63:in `block in with'
2015-10-09T18:41:30.395747+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `handle_interrupt'
2015-10-09T18:41:30.393270+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
2015-10-09T18:41:30.393273+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2015-10-09T18:41:30.393276+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
2015-10-09T18:41:30.393280+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/instrumentable.rb:31:in `instrument'
2015-10-09T18:41:30.393286+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:631:in `logging'
2015-10-09T18:41:30.393289+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:602:in `flush'
2015-10-09T18:41:30.393294+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:406:in `process'
2015-10-09T18:41:30.395751+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.2.0/lib/connection_pool.rb:60:in `with'
2015-10-09T18:41:30.395754+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:116:in `connection'
2015-10-09T18:41:30.395757+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/operation/read.rb:52:in `block in execute'
2015-10-09T18:41:30.395762+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:608:in `[]'
2015-10-09T18:41:30.395768+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:608:in `block (3 levels) in flush'
2015-10-09T18:41:30.395771+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:607:in `map'
2015-10-09T18:41:30.395776+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:607:in `block (2 levels) in flush'
2015-10-09T18:41:30.395781+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:185:in `ensure_connected'
2015-10-09T18:41:30.393300+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/operation/read.rb:48:in `execute'
2015-10-09T18:41:30.395786+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:603:in `block in flush'
2015-10-09T18:41:30.395790+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/moped-2.0.7/lib/moped/node.rb:632:in `block in logging'
2015-10-09T18:41:30.395795+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
2015-10-09T18:41:30.395800+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'

Support draw

If we're going to allow people to play chess they should be able to draw.

@x: chessbot draw

X is asking Y to draw.

@y: chessbot draw

X and Y ended up in a draw.

This can be refined, a draw in chess can specifically be a stalemate.

Socket :close isn't properly restarting bot

2015-12-24T13:18:48.644709+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:61:in `restart!'
2015-12-24T13:18:48.644716+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:61:in `restart!'
2015-12-24T13:18:48.644727+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:61:in `restart!'
2015-12-24T13:18:48.644735+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:61:in `restart!'
2015-12-24T13:18:48.644740+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:61:in `restart!'
2015-12-24T13:18:48.644745+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:61:in `restart!'
2015-12-24T13:18:48.644753+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-client-0.5.0/lib/slack/real_time/client.rb:102:in `block (2 levels) in run_loop'
2015-12-24T13:18:48.644717+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/slack-ruby-bot-0.5.1/lib/slack-ruby-bot/server.rb:70:in `rescue in restart!'

Bot doesn't survive migration_in_progress on start

2015-07-17T22:39:13.867979+00:00 heroku[web.1]: State changed from starting to up
2015-07-17T22:39:14.326781+00:00 app[web.1]: I, [2015-07-17T22:39:14.326661 #3]  INFO -- : Successfully connected to https://artsy.slack.com/.
2015-07-18T16:19:10.943269+00:00 app[web.1]: migration_in_progress
2015-07-18T16:19:10.943310+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-ruby-bot-0.2.0/lib/initializers/slack/request.rb:9:in `request'
2015-07-18T16:19:10.943314+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-api-1.1.6/lib/slack/request.rb:11:in `post'
2015-07-18T16:19:10.943317+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-api-1.1.6/lib/slack/api.rb:26:in `realtime'
2015-07-18T16:19:10.943319+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-api-1.1.6/lib/slack.rb:20:in `method_missing'
2015-07-18T16:19:10.943321+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-ruby-bot-0.2.0/lib/slack-ruby-bot/app.rb:52:in `client'
2015-07-18T16:19:10.943326+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-ruby-bot-0.2.0/lib/slack-ruby-bot/app.rb:45:in `block in start!'
2015-07-18T16:19:10.943329+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-ruby-bot-0.2.0/lib/slack-ruby-bot/app.rb:44:in `loop'
2015-07-18T16:19:10.943334+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-ruby-bot-0.2.0/lib/slack-ruby-bot/app.rb:44:in `start!'
2015-07-18T16:19:10.943339+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/slack-ruby-bot-0.2.0/lib/slack-ruby-bot/app.rb:27:in `run'
2015-07-18T16:19:10.943342+00:00 app[web.1]: config.ru:7:in `block (2 levels) in <main>'

And that's the beginning and the end.

Undefined method error for hooks

I'm trying to integrate the user_change hook into a bot i'm working on at the moment but getting an undefined method error any time the hook is triggered in slack.

I've included a sample stack trace and snippets below to demonstrate how i've set the hook up. Am I doing something wrong here or is this a bug?

E, [2015-12-09T11:48:49.279250 #11425] ERROR -- : undefined method `user_change' for #<SlackRubyBot::App:0x007fae4245cb10> (NoMethodError)
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-bot-0.4.5/lib/slack-ruby-bot/app.rb:74:in `block (2 levels) in client'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-client-0.4.0/lib/slack/real_time/client.rb:104:in `call'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-client-0.4.0/lib/slack/real_time/client.rb:104:in `block in dispatch'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-client-0.4.0/lib/slack/real_time/client.rb:103:in `each'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-client-0.4.0/lib/slack/real_time/client.rb:103:in `dispatch'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-client-0.4.0/lib/slack/real_time/client.rb:52:in `block (3 levels) in start!'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:31:in `call'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:31:in `block in emit'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:30:in `each'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:30:in `emit'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/faye-websocket-0.10.2/lib/faye/websocket/api/event_target.rb:45:in `dispatch_event'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/faye-websocket-0.10.2/lib/faye/websocket/api.rb:106:in `receive_message'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/faye-websocket-0.10.2/lib/faye/websocket/api.rb:40:in `block in initialize'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:31:in `call'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:31:in `block in emit'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:30:in `each'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/event_emitter.rb:30:in `emit'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/hybi.rb:403:in `emit_message'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/hybi.rb:386:in `emit_frame'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/hybi.rb:118:in `parse'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/websocket-driver-0.5.4/lib/websocket/driver/client.rb:57:in `parse'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/faye-websocket-0.10.2/lib/faye/websocket/api.rb:145:in `parse'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/faye-websocket-0.10.2/lib/faye/websocket/client.rb:71:in `receive_data'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:193:in `run_machine'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:193:in `run'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-client-0.4.0/lib/slack/real_time/client.rb:38:in `start!'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-bot-0.4.5/lib/slack-ruby-bot/app.rb:47:in `block in start!'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-bot-0.4.5/lib/slack-ruby-bot/app.rb:45:in `loop'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-bot-0.4.5/lib/slack-ruby-bot/app.rb:45:in `start!'
/Users/jakekelly/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slack-ruby-bot-0.4.5/lib/slack-ruby-bot/app.rb:28:in `run'
/Users/jakekelly/dev/feedback-bot/config.ru:10:in `block (2 levels) in <main>'

feedback-bot/hooks/user_change.rb

module FeedbackBot
  module Hooks
    module UserChange
      extend SlackRubyBot::Hooks::Base

      def user_change(_client, data)
        p data
      end
    end
  end
end

feedback-bot/app.rb

module FeedbackBot
  class App < SlackRubyBot::App
    include FeedbackBot::Hooks::UserChange
  end
end

Support humiliation

Sometimes players lose so badly I'd like slack-gamebot to say "x humiliated y".

Handle account_inactive, disable team

We try to restart teams that disable integrations on their side. Should just disable the team automatically and require a re-add to slack to enable it.

2015-12-22T13:34:58.180854+00:00 app[web.1]: E, [2015-12-22T13:34:58.180738 #3] ERROR -- : xoxb-171409***: account_inactive, restarting in 60 second(s).

Add support for seasons.

You should be able to DM gamebot to start a new season with an admin secret.

gamebot new season

Old seasons should remain accessible via gamebot seasons, so something like gamebot season 1 leaderboard (and other commands)

Seasons can be aliased to tournaments, too. Maybe we should allow you to run multiple at the same time, but that's a stretch.

Support u suck

screen shot 2015-09-09 at 5 31 16 pm

The gamebot should respond with "no, you suck" or something like that.

Transform API errors into 400 status code

Right now just throwing 500s.

2015-12-19T16:17:47.223437+00:00 heroku[router]: at=info method=POST path="/teams" host=pong.playplay.io request_id=cf76358c-a2db-4bac-a5c0-88cc92726d66 fwd="24.90.107.1" dyno=web.1 connect=0ms service=965ms status=500 bytes=154
2015-12-19T16:17:47.223893+00:00 app[web.1]:   Validation of Team failed.
2015-12-19T16:17:47.223885+00:00 app[web.1]: 2015-12-19 16:17:47 +0000: Rack app error: #<Mongoid::Errors::Validations: 
2015-12-19T16:17:47.223891+00:00 app[web.1]: message:
2015-12-19T16:17:47.223894+00:00 app[web.1]: summary:
2015-12-19T16:17:47.223894+00:00 app[web.1]:   The following errors were found: Token is already taken
2015-12-19T16:17:47.223895+00:00 app[web.1]: resolution:
2015-12-19T16:17:47.224315+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/persistable/creatable.rb:175:in `create!'
2015-12-19T16:17:47.224304+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/persistable.rb:78:in `fail_due_to_validation!'

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.