{"id":15487863,"url":"https://github.com/dblock/slack-gamebot","last_synced_at":"2025-04-07T13:08:07.499Z","repository":{"id":31170253,"uuid":"34730464","full_name":"dblock/slack-gamebot","owner":"dblock","description":"Ping pong, chess, pool and other games bot for Slack.","archived":false,"fork":false,"pushed_at":"2024-08-28T17:15:57.000Z","size":34700,"stargazers_count":129,"open_issues_count":57,"forks_count":103,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-09T23:10:56.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dblock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-28T12:57:37.000Z","updated_at":"2024-08-28T17:16:00.000Z","dependencies_parsed_at":"2023-02-12T07:45:22.430Z","dependency_job_id":"bc1d4de4-ad14-487b-8493-ce2eda9595d8","html_url":"https://github.com/dblock/slack-gamebot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fslack-gamebot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fslack-gamebot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fslack-gamebot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dblock%2Fslack-gamebot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dblock","download_url":"https://codeload.github.com/dblock/slack-gamebot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657281,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T06:42:41.725Z","updated_at":"2025-04-07T13:08:07.482Z","avatar_url":"https://github.com/dblock.png","language":"Ruby","funding_links":[],"categories":[":gear: \u0026nbsp; Open-Source Slack Apps and Integrations"],"sub_categories":["Ruby"],"readme":"Slack-Gamebot\n=============\n\n[![Add to Slack](https://platform.slack-edge.com/img/add_to_slack@2x.png)](https://www.playplay.io)\n\nOr roll your own ...\n\n[![Tests](https://github.com/dblock/slack-gamebot/actions/workflows/test.yml/badge.svg)](https://github.com/dblock/slack-gamebot/actions/workflows/test.yml)\n[![Code Climate](https://codeclimate.com/github/dblock/slack-gamebot/badges/gpa.svg)](https://codeclimate.com/github/dblock/slack-gamebot)\n\nA generic game bot for slack. Works for ping-pong (2, 4 or more players), chess, etc. Inspired by [slack-pongbot](https://github.com/andrewvy/slack-pongbot), but more robust, generic and easier to improve and contribute to.\n\n![](screenshots/game.gif)\n\n## Installation\n\nCreate a new Bot Integration under [services/new/bot](http://slack.com/services/new/bot). Note the API token.\nYou will be able to invoke gamebot by the name you give it in the UI above.\n\nRun `SLACK_API_TOKEN=\u003cyour API token\u003e foreman start`\n\n## Production Deployment\n\nSee [DEPLOYMENT](DEPLOYMENT.md)\n\n## Usage\n\nStart talking to your bot!\n\n![](screenshots/hi.png)\n\n### Commands\n\n#### gamebot\n\nShows GameBot version and links.\n\n#### gamebot hi\n\nPolitely says 'hi' back.\n\n#### gamebot help\n\nGet help.\n\n#### gamebot info\n\nBot credits.\n\n#### gamebot sucks\n\nYou can tell the bot that it sucks. But it will talk back.\n\n![](screenshots/sucks.gif)\n\n#### gamebot register\n\nRe-registers a user. This is automatic, but a user can unregister and come back with this command.\n\n![](screenshots/register.gif)\n\nThis 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.\n\n```\ngamebot register\n\nWelcome back Victor Barna! I've updated your registration.\n```\n\nYou can also remove yourself from the leaderboard with `gamebot unregister me` and re-register youself again with `gamebot register`.\nThe data is not removed, but the user will no longer appear in the leaderboards and cannot participate in challenges.\n\n#### gamebot challenge \u0026lt;opponent\u0026gt; ... [with \u0026lt;teammate\u0026gt; ...]\n\nCreates a new challenge between you and an opponent.\n\n```\ngamebot challenge @WangHoe\n\nVictor Barna challenged Wang Hoe to a match!\n```\n\nYou can challenge anyone to play.\n\n```\ngamebot challenge @here\n\nVictor Barna challenged anyone to a match!\n```\n\nYou can create group challenges, too. Both sides must have the same number of players.\n\n```\ngamebot challenge @WangHoe @ZhangJike with @DengYaping\n\nVictor Barna and Deng Yaping challenged Wang Hoe and Zhang Jike to a match!\n```\n\n#### gamebot challenge?\n\nShow elo at stake for each opponent.\n\n```\ngamebot challenge? @WangHoe\n\nVictor Barna challenging Wang Hoe to a match is worth 48 and 24 elo.\n```\n\n#### gamebot accept\n\nAccept a challenge.\n\n```\ngamebot accept\n\nWang Hoe and Zhang Jike accepted Victor Barna and Deng Yaping's challenge.\n```\n\n#### gamebot lost [to \u0026lt;opponent\u0026gt; [with \u0026lt;teammate\u0026gt;]] [score ...]\n\nRecord your loss.\n\n![](screenshots/lost.gif)\n\nYou cannot record a win.\n\nRecord your loss with a score, loser first.\n\n```\ngamebot lost 5:21\n\nMatch has been recorded! Wang Hoe crushed Victor Barna with the score of 21:5.\n```\n\nYou can record scores for an entire match.\n\n```\ngamebot lost 15:21 21:17 18:21\n\nMatch has been recorded! Wang Hoe defeated Victor Barna with the scores of 21:15 17:21 21:18.\n```\n\nYou can record scores for a match you have already lost.\n\n```\ngamebot lost\n\nMatch has been recorded! Wang Hoe defeated Victor Barna.\n\ngamebot lost 15:21 21:17 18:21\n\nMatch scores have been updated! Wang Hoe defeated Victor Barna with the scores of 21:15 17:21 21:18.\n```\n\nYou can record a loss without a challenge.\n\n![](screenshots/lost_to.gif)\n\nYou can also record scores and record lost matches without a challenge including with multiple players.\n\n```\ngamebot lost to @WangHoe @ZhangJike with @DengYaping 5:21\n\nMatch has been recorded! Wang Hoe and Zhang Jike defeated Victor Barna and Deng Yaping with the score of 21:5.\n```\n\n#### gamebot draw [score ...]\n\nDraws a challenge, records a tie. All other players will also have to draw to record a match.\n\n```\ngamebot draw\n\nMatch is a draw, waiting to hear from Victor Barna.\n\ngamebot draw 2:2\n\nMatch has been recorded. Victor Barna tied with Zhang Jike with a score of 2:2.\n```\n\nYou can also record scores and ties without a challenge.\n\n```\ngamebot draw to @VictorBarna\n\nMatch is a draw, waiting to hear from Victor Barna.\n\ngamebot draw 2:2\n\nMatch is a draw! Wang Hoe tied with Victor Barna with the score of 2:2.\n```\n\nYou can also record scores and have multiple players.\n\n#### gamebot resigned [to \u0026lt;opponent\u0026gt; [with \u0026lt;teammate\u0026gt;]]\n\nRecords your resignation, which is a special kind of `lost` without a score.\n\n```\ngamebot resigned\n\nMatch has been recorded! Victor Barna resigned against Wang Hoe.\n```\n\n![](screenshots/resigned.gif)\n\nYou can resign without a prior challenge.\n\n```\ngamebot resigned to WangHoe\n\nMatch has been recorded! Victor Barna resigned against Wang Hoe.\n```\n\n#### gamebot decline\n\nDecline a challenge.\n\n```\ngamebot decline\n\nWang Hoe and Zhang Jike declined Victor Barna and Deng Yaping's challenge.\n```\n\n#### gamebot cancel\n\nCancel a challenge.\n\n```\ngamebot cancel\n\nVictor Barna and Deng Yaping canceled a challenge against Wang Hoe and Zhang Jike.\n```\n\n#### gamebot taunt \u0026lt;opponent\u0026gt; [\u0026lt;opponent\u0026gt; ...]\n\nTaunt other players.\n\n```\ngamebot taunt @WangHoe\n\nVictor Barna says Wang Hoe sucks at ping pong!\n```\n\n#### gamebot leaderboard [number|infinity]\n\nGet the leaderboard.\n\n```\ngamebot leaderboard\n\n1. Victor Barna: 3 wins, 2 losses (elo: 148, lws: 5)\n2. Deng Yaping: 1 win, 3 losses (elo: 24)\n3. Wang Hoe: 0 wins, 1 loss (elo: -12)\n```\n\nThe leaderboard contains players ranked by [Elo](http://en.wikipedia.org/wiki/Elo_rating_system), 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.\n\nThe leaderboard also shows the longest winning (lws) and losing (lls) streaks of at least 3.\n\nIn 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`:\n\n```\ngamebot leaderboard -5\n\n1. Wang Hoe: 0 wins, 1 loss (elo: -12)\n2. Deng Yaping: 1 win, 3 losses (elo: 24)\n3. Victor Barna: 3 wins, 2 losses (elo: 148, lws: 5)\n```\n\n#### gamebot matches [number|infinity]\n\nDisplays top 10 match totals in the current season.\n\n```\ngamebot matches\n\nVictor Barna defeated Wang Hoe 3 times\nDeng Yaping defeated Victor Barna once\n```\n\nYou can also get match totals for specific players.\n\n```\ngamebot matches @WangHoe\n\nVictor Barna defeated Wang Hoe 5 times\nWang Hoe defeated Deng Yaping twice\n```\n\nUse _matches 3_ to see top 3 matches o _matches inifinity_ to see all matches in the season.\n\n#### gamebot challenges\n\nDisplays all outstanding (proposed and accepted) challenges.\n\n#### gamebot rank [\u0026lt;player\u0026gt; ...]\n\nShow the smallest range of ranks for a list of players.  If no user is specified, your rank is shown.\n\n```\ngamebot rank @WangHoe @DengYaping\n\n2. Deng Yaping: 1 win, 3 losses (elo: 24)\n3. Wang Hoe: 0 wins, 1 loss (elo: -12)\n```\n\n#### gamebot promote \u0026lt;player\u0026gt; ...\n\nPromotes other users to captain. Must be a captain to do that.\n\n```\ngamebot promote @WangHoe @DengYaping\n\nVictor Barna promoted Wang Hoe and Deng Yaping to captain.\n```\n\n#### gamebot demote me\n\nDemotes from captain to a normal user. Must be a captain and the team must have other captains to do this.\n\n```\ngamebot demote me\n\nVictor Barna is no longer captain.\n```\n\n#### gamebot team\n\nDisplay current team's info, including captains.\n\n```\ngamebot team\n\nTeam _China_, captains Deng Yaping and Victor Barna.\n```\n\n#### gamebot reset \u0026lt;team id|team name\u0026gt;\n\nReset 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.\n\n```\ngamebot reset china\n\nWelcome to the new season!\n```\n\n#### gamebot season\n\nDisplay current season's leader and game totals.\n\n```\ngamebot season\n\nCurrent: Deng Yaping: 1 win, 0 losses (elo: 48), 1 game, 2 players\n```\n\n#### gamebot seasons\n\nDisplay current season's leader, past seasons' winners and game totals.\n\n```\ngamebot seasons\n\nCurrent: Deng Yaping: 1 win, 0 losses (elo: 48), 1 game, 2 players\n2015-07-16: Wang Hoe: 28 wins, 19 losses (elo: 214), 206 games, 25 players\n```\n\n#### gamebot unregister \u0026lt;player\u0026gt;\n\nCaptains can remove users.\n\n```\ngamebot unregister @WangHoe\n\nI've removed @WangHoe from the leaderboard.\n```\n\nUsers that have left a Slack team can be removed by omitting the `@`, eg. `gamebot unregister WangHoe`.\n\n#### gamebot set nickname [name]\n\nSets a nickname for display purposes.\n\n```\ngamebot set nickname John Doe\n```\n\nUnset a nickname.\n\n```\ngamebot unset nickname\n```\n\nCaptains can set nicknames of users by using a Slack mention.\n\n```\ngamebot set nickname @WangHoe John Doe\n```\n\nCaptains can unset nicknames, too.\n\n```\ngamebot unset nickname @WangHoe\n```\n\n#### gamebot set gifs on|off\n\nEnable/disable GIFs for your team.\n\n```\ngamebot set gifs off\n\nGIFs for team China are off.\n```\n\n![](screenshots/gifs.gif)\n\nUsing `unset gifs` is equivalent to `set gifs off`.\n\n#### gamebot set leaderboard max [number|infinity]\n\nSet and resets the leaderboard max. Default is inifinity, ie. to show the entire leaderboard.\n\n```\ngamebot set leaderboard max 5\n```\n\nThe following are equivalent.\n\n```\ngamebot set leaderboard max 0\ngamebot set leaderboard max infinity\ngamebot unset leaderboard max\n```\n\n#### gamebot set elo [number]\n\nSet and resets the base elo for new seasons. Default is 0.\n\n```\ngamebot set elo 1000\n```\n\n```\ngamebot unset elo\n```\n\n#### gamebot set aliases \u0026lt;alias|none\u0026gt; ...\n\nSet additional aliases for the bot. For example you could upload a custom emoji for :pong: and set an alias for it.\n\n```\ngamebot set aliases pp :pong:\n\nTeam China aliases are set to pp and :pong:.\n```\n\n![](screenshots/aliases.gif)\n\nRemove all aliases with `unset aliases`.\n\n#### gamebot set api on|off\n\nEnable/disable team data in the public API for your team and displays team API URL.\n\n```\ngamebot set api on\n\nAPI for team China is on!\nhttp://www.playplay.io/api/teams/57224e65bc526eac95bfe316\n```\n\n```\ngamebot unset api\n\nAPI for team China is off.\n```\n\n#### gamebot set unbalanced on|off\n\nAllow unbalanced challenges with different number of opponents.\n\n```\ngamebot set unbalanced on\n\nUnbalanced challenges for team China are on!\n```\n\n#### gamebot subscription\n\nDM to show paid subscription information.\n\n```\nsubscription\n\nYour trial subscription expires in 13 days. Subscribe your team for $29.99 a year at ... .\n```\n\nCaptains are able to see credit card info.\n\n```\nsubscription\n\nCustomer since August 11, 2018.\nSubscribed to Slack PlayPlay (Yearly) ($29.99), will auto-renew on August 11, 2019.\nInvoice for $29.99 on August 11, 2018, paid.\nOn file Visa card, user@example.com ending with 4242, expires 2/2022.\nUpdate your credit card info at ... .\n```\n\n#### gamebot unsubscribe [id]\n\nDM to cancel auto-renew for a paid subscription.\n\n```\nunsubscribe\n\nSubscribed to Slack PlayPlay (Yearly) ($29.99), will auto-renew on August 11, 2019.\nSend `unsubscribe sub_DOvlBd1lETNimB` to unsubscribe.\n```\n\n```\nunsubscribe sub_DOvlBd1lETNimB\n\nSuccessfully canceled auto-renew for Slack PlayPlay (Yearly) ($29.99).\n```\n\n## API\n\nSlack-gamebot implements a Hypermedia API. Navigate to the application root to browse through available objects and methods. PlayPlay.io's Gamebot is [here](http://www.playplay.io/api), you can see [dblock's current ping-pong elo here](http://www.playplay.io/api/users/5543f64d6237640003000000).\n\nA 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.\n\n![](screenshots/api.png)\n\nWe recommend [HyperClient](https://github.com/codegram/hyperclient) to query the API programmatically in Ruby.\n\n## Contributing\n\nThis bot is built with [slack-ruby-bot-server](https://github.com/dblock/slack-ruby-bot-server). See [CONTRIBUTING](CONTRIBUTING.md).\n\n## Copyright and License\n\nCopyright (c) 2015-2019, Daniel Doubrovkine, Vestris LLC, Artsy and [Contributors](CHANGELOG.md).\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdblock%2Fslack-gamebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdblock%2Fslack-gamebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdblock%2Fslack-gamebot/lists"}