repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/seasons_endpoint_spec.rb | spec/api/endpoints/seasons_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::SeasonsEndpoint do
include Api::Test::EndpointTest
let!(:team) { Fabricate(:team, api: true) }
before do
@cursor_params = { team_id: team.id.to_s }
end
it_behaves_like 'a cursor api', Season
it 'cannot return seasons for a team with api off' do
tea... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/users_endpoint_spec.rb | spec/api/endpoints/users_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::UsersEndpoint do
include Api::Test::EndpointTest
let!(:team) { Fabricate(:team, api: true) }
before do
@cursor_params = { team_id: team.id.to_s }
end
it_behaves_like 'a cursor api', User
context 'user' do
let(:existing_user) { Fabricate(:user) }
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/challenges_endpoint_spec.rb | spec/api/endpoints/challenges_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::ChallengesEndpoint do
include Api::Test::EndpointTest
let!(:team) { Fabricate(:team, api: true) }
before do
@cursor_params = { team_id: team.id.to_s }
end
it_behaves_like 'a cursor api', Challenge
it 'cannot return challenges for team with api off' do
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/matches_endpoint_spec.rb | spec/api/endpoints/matches_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::MatchesEndpoint do
include Api::Test::EndpointTest
let!(:team) { Fabricate(:team, api: true) }
before do
@cursor_params = { team_id: team.id.to_s }
end
it_behaves_like 'a cursor api', Match
it 'cannot return matches for a team with api off' do
team... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/root_endpoint_spec.rb | spec/api/endpoints/root_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::RootEndpoint do
include Api::Test::EndpointTest
it 'hypermedia root' do
get '/api/'
expect(last_response.status).to eq 200
links = JSON.parse(last_response.body)['_links']
expect(links.keys.sort).to eq(%w[self status team teams user users challenge ch... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/teams_endpoint_spec.rb | spec/api/endpoints/teams_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::TeamsEndpoint do
include Api::Test::EndpointTest
let!(:game) { Fabricate(:game) }
context 'cursor' do
it_behaves_like 'a cursor api', Team
end
context 'team' do
let(:existing_team) { Fabricate(:team, game:) }
it 'returns a team' do
team = c... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/games_endpoint_spec.rb | spec/api/endpoints/games_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::GamesEndpoint do
include Api::Test::EndpointTest
it_behaves_like 'a cursor api', Game
context 'game' do
let(:existing_game) { Fabricate(:game) }
it 'returns a game' do
game = client.game(id: existing_game.id)
expect(game.id).to eq existing_gam... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/api/endpoints/subscriptions_endpoint_spec.rb | spec/api/endpoints/subscriptions_endpoint_spec.rb | require 'spec_helper'
describe Api::Endpoints::SubscriptionsEndpoint do
include Api::Test::EndpointTest
context 'subcriptions' do
it 'requires stripe parameters' do
expect { client.subscriptions._post }.to raise_error Faraday::ClientError do |e|
json = JSON.parse(e.response[:body])
expec... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/version_spec.rb | spec/slack-gamebot/version_spec.rb | require 'spec_helper'
describe SlackGamebot do
it 'has a version' do
expect(SlackGamebot::VERSION).not_to be_nil
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/service_spec.rb | spec/slack-gamebot/service_spec.rb | require 'spec_helper'
describe SlackRubyBotServer::Service do
describe '#url' do
before do
@rack_env = ENV.fetch('RACK_ENV', nil)
end
after do
ENV['RACK_ENV'] = @rack_env
end
it 'defaults to playplay.io in production' do
expect(SlackRubyBotServer::Service.url).to eq 'https://w... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/server_spec.rb | spec/slack-gamebot/server_spec.rb | require 'spec_helper'
describe SlackGamebot::Server do
let(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'send_gifs' do
context 'default' do
let(:team) { Fabricate(:team) }
it 'true' do
expect(app.send(:client).sen... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/app_spec.rb | spec/slack-gamebot/app_spec.rb | require 'spec_helper'
describe SlackGamebot::App do
subject do
SlackGamebot::App.instance
end
describe '#instance' do
it 'is an instance of the market app' do
expect(subject).to be_a(SlackRubyBotServer::App)
expect(subject).to be_an_instance_of(SlackGamebot::App)
end
end
context 'te... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/unknown_spec.rb | spec/slack-gamebot/commands/unknown_spec.rb | require 'spec_helper'
describe SlackRubyBot::Commands::Unknown, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:message_hook) { SlackRubyBot::Hooks::Message.new }
it 'invalid command' do
expect(... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/promote_spec.rb | spec/slack-gamebot/commands/promote_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Promote, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:user) { Fabricate(:user, team:, user_name: 'username', captain: true) }
it 'gives help... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/resigned_spec.rb | spec/slack-gamebot/commands/resigned_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Resigned, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'with a challenge' do
let(:challenged) { Fabricate(:user, user_name: 'username')... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/accept_spec.rb | spec/slack-gamebot/commands/accept_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Accept, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'regular challenge' do
let(:challenged) { Fabricate(:user, team:, user_name: 'user... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/lost_spec.rb | spec/slack-gamebot/commands/lost_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Lost, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'with an existing challenge' do
let(:challenged) { Fabricate(:user, user_name: 'user... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/season_spec.rb | spec/slack-gamebot/commands/season_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Season, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'season' do
context 'no seasons' do
it 'seasons' do
expe... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/team_spec.rb | spec/slack-gamebot/commands/team_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Team, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'no users' do
it 'team' do
allow(User).to receive(:find_create_or_update_by_sl... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/challenge_spec.rb | spec/slack-gamebot/commands/challenge_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Challenge, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:user) { Fabricate(:user, user_name: 'username') }
let(:opponent) { Fabricate(:user) }... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/default_spec.rb | spec/slack-gamebot/commands/default_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Default do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:message_hook) { SlackRubyBot::Hooks::Message.new }
it 'default' do
expect(client).to receive(:say).with(channel: 'chann... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/rank_spec.rb | spec/slack-gamebot/commands/rank_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Rank, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'rank' do
let!(:user_elo_12) { Fabricate(:user, elo: 12, wins: 0, losses... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/register_spec.rb | spec/slack-gamebot/commands/register_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Register, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
it 'registers a new user and promotes them to captain' do
Fabricate(:user, team: Fabrica... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/unsubscribe_spec.rb | spec/slack-gamebot/commands/unsubscribe_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Unsubscribe, vcr: { cassette_name: 'user_info' } do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'unsubscribe' do
context 'on trial' do
before do
team.update_attributes!(subscribed: f... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/reset_spec.rb | spec/slack-gamebot/commands/reset_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Reset, vcr: { cassette_name: 'user_info' } do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let!(:team) { Fabricate(:team) }
it 'requires a captain' do
Fabricate(:user, captain: true, team:)
Fabricate(:user, user... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/demote_spec.rb | spec/slack-gamebot/commands/demote_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Demote, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'captain' do
let(:user) { Fabricate(:user, team:, user_name: 'username', captain: ... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/subscription_spec.rb | spec/slack-gamebot/commands/subscription_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Subscription, vcr: { cassette_name: 'user_info' } do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'subscription' do
context 'on trial' do
before do
team.update_attributes!(subscribed:... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/leaderboard_spec.rb | spec/slack-gamebot/commands/leaderboard_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Leaderboard do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'leaderboard' do
context 'with players' do
let!(:user_elo_42) { Fabricate(:user, elo: 42, wins: ... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/cancel_spec.rb | spec/slack-gamebot/commands/cancel_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Cancel, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'challenger' do
let(:challenger) { Fabricate(:user, user_name: 'username') }
l... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/set_spec.rb | spec/slack-gamebot/commands/set_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Set, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:captain) { Fabricate(:user, team:, user_name: 'username', captain: true) }
let(:message_hoo... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/hi_spec.rb | spec/slack-gamebot/commands/hi_spec.rb | require 'spec_helper'
describe SlackRubyBot::Commands::Hi do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
it 'says hi' do
expect(message: "#{SlackRubyBot.config.user} hi").to respond_with_slack_message('Hi <@user>!')
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/matches_spec.rb | spec/slack-gamebot/commands/matches_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Matches, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'matches' do
let!(:team) { Fabricate(:team) }
let(:user) { Fabric... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/seasons_spec.rb | spec/slack-gamebot/commands/seasons_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Seasons, vcr: { cassette_name: 'user_info' } do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
shared_examples_for 'seasons' do
context 'no seasons' do
it 'seasons' do
expect(message: "#{SlackRubyBot.confi... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/help_spec.rb | spec/slack-gamebot/commands/help_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Help do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:message_hook) { SlackRubyBot::Hooks::Message.new }
context 'subscribed team' do
let!(:team) { Fabricate(:team, subscribed: true) }
it 'help' do
ex... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/decline_spec.rb | spec/slack-gamebot/commands/decline_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Decline, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:challenged) { Fabricate(:user, user_name: 'username') }
let!(:challenge) { Fabricate(:c... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/sucks_spec.rb | spec/slack-gamebot/commands/sucks_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Sucks, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:user) { Fabricate(:user) }
let(:client) { app.send(:client) }
it 'sucks' do
expect(message: "#{SlackRubyBot.config.user... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/challenge_question_spec.rb | spec/slack-gamebot/commands/challenge_question_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::ChallengeQuestion, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:user) { Fabricate(:user, user_name: 'username') }
let(:opponent) { Fabricate(... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/taunt_spec.rb | spec/slack-gamebot/commands/taunt_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Taunt, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:user) { Fabricate(:user, user_name: 'username') }
it 'taunts one person by user id' do
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/info_spec.rb | spec/slack-gamebot/commands/info_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Info do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:message_hook) { SlackRubyBot::Hooks::Message.new }
let(:team) { Fabricate(:team) }
it 'info' do
expect(client).to receive(:say).with(channel: 'channel', te... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/challenges_spec.rb | spec/slack-gamebot/commands/challenges_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Challenges, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let(:user) { Fabricate(:user, user_name: 'username') }
context 'with challenges' do
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/unregister_spec.rb | spec/slack-gamebot/commands/unregister_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Unregister, vcr: { cassette_name: 'user_info' } do
context 'team' do
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
let!(:team) { Fabricate(:team) }
it 'requires a captain to unregister someone' do
Fabrica... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/slack-gamebot/commands/draw_spec.rb | spec/slack-gamebot/commands/draw_spec.rb | require 'spec_helper'
describe SlackGamebot::Commands::Draw, vcr: { cassette_name: 'user_info' } do
let!(:team) { Fabricate(:team) }
let(:app) { SlackGamebot::Server.new(team:) }
let(:client) { app.send(:client) }
context 'with a challenge' do
let(:challenged) { Fabricate(:user, user_name: 'username') }
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/fabricators/season_fabricator.rb | spec/fabricators/season_fabricator.rb | Fabricator(:season) do
team { Team.first || Fabricate(:team) }
before_create do
Fabricate(:match, team:) if Challenge.current.none?
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/fabricators/match_fabricator.rb | spec/fabricators/match_fabricator.rb | Fabricator(:match_lost_to, class_name: 'Match') do
after_build do |match|
match.scores = match.tied? ? [[3, 3]] : [[15, 21]]
end
end
Fabricator(:match) do
after_build do |match|
match.challenge ||= Fabricate(:challenge, team: match.team || Team.first || Fabricate(:team))
match.team = challenge.team
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/fabricators/team_fabricator.rb | spec/fabricators/team_fabricator.rb | Fabricator(:team) do
token { Fabricate.sequence(:team_token) { |i| "abc-#{i}" } }
team_id { Fabricate.sequence(:team_id) { |i| "T#{i}" } }
activated_user_id { Fabricate.sequence(:activated_user_id) { |i| "U#{i}" } }
game { Game.first || Fabricate(:game) }
name { Faker::Lorem.word }
api { true }
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/fabricators/challenge_fabricator.rb | spec/fabricators/challenge_fabricator.rb | Fabricator(:challenge) do
channel 'gamebot'
team { Team.first || Fabricate(:team) }
before_create do |instance|
instance.challengers << Fabricate(:user, team: instance.team) unless instance.challengers.any?
instance.challenged << Fabricate(:user, team: instance.team) unless instance.challenged.any?
in... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/fabricators/user_fabricator.rb | spec/fabricators/user_fabricator.rb | Fabricator(:user) do
user_id { Fabricate.sequence(:user_id) { |i| "U#{i}" } }
user_name { Faker::Internet.user_name }
team { Team.first || Fabricate(:team) }
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/spec/fabricators/game_fabricator.rb | spec/fabricators/game_fabricator.rb | Fabricator(:game) do
name { Faker::Lorem.word }
client_id { Faker::Internet.password(min_length: 8) }
client_secret { Faker::Internet.password(min_length: 16) }
aliases { Faker::Lorem.words }
after_build do |game|
game.bot_name = game.name + 'bot'
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/version.rb | slack-gamebot/version.rb | module SlackGamebot
VERSION = '0.4.0'.freeze
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models.rb | slack-gamebot/models.rb | require 'slack-gamebot/models/game'
require 'slack-gamebot/models/team'
require 'slack-gamebot/models/elo'
require 'slack-gamebot/models/user'
require 'slack-gamebot/models/user_rank'
require 'slack-gamebot/models/challenge_state'
require 'slack-gamebot/models/challenge'
require 'slack-gamebot/models/score'
require 'sl... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/api.rb | slack-gamebot/api.rb | require 'grape'
require 'roar'
require 'grape-roar'
require 'slack-gamebot/api/helpers'
require 'slack-gamebot/api/presenters'
require 'slack-gamebot/api/endpoints'
require 'slack-gamebot/api/middleware'
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/app.rb | slack-gamebot/app.rb | module SlackGamebot
class App < SlackRubyBotServer::App
DEAD_MESSAGE = <<~EOS.freeze
This leaderboard has been dead for over a month, deactivating.
Re-install the bot at https://www.playplay.io. Your data will be purged in 2 weeks.
EOS
def after_start!
once_and_every 60 * 60 * 24 do
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/info.rb | slack-gamebot/info.rb | module SlackGamebot
INFO = <<~EOS.freeze
Gamebot #{SlackGamebot::VERSION}
© Daniel Doubrovkine, Vestris LLC & Contributors, MIT License
https://www.vestris.com
Hosted at https://www.playplay.io
Follow Us at https://twitter.com/playplayio
Open-Source at https://github.com/dblock/slack-gamebot... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands.rb | slack-gamebot/commands.rb | require 'slack-gamebot/commands/mixins'
require 'slack-gamebot/commands/accept'
require 'slack-gamebot/commands/cancel'
require 'slack-gamebot/commands/challenge'
require 'slack-gamebot/commands/challenge_question'
require 'slack-gamebot/commands/challenges'
require 'slack-gamebot/commands/decline'
require 'slack-gameb... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/server.rb | slack-gamebot/server.rb | module SlackGamebot
class Server < SlackRubyBotServer::RealTime::Server
def initialize(attrs = {})
attrs = attrs.dup
attrs[:aliases] = ([attrs[:team].game.name] + [attrs[:team].aliases]).flatten.compact
super
end
on :user_change do |client, data|
user = User.where(team: client.own... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/service.rb | slack-gamebot/service.rb | module SlackRubyBotServer
class Service
def self.url
ENV.fetch('URL') { (ENV['RACK_ENV'] == 'development' ? 'http://localhost:5000' : 'https://www.playplay.io') }
end
def self.api_url
ENV.fetch('API_URL') { "#{url}/api" }
end
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/error.rb | slack-gamebot/error.rb | module SlackGamebot
class Error < StandardError
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/subscription.rb | slack-gamebot/commands/subscription.rb | module SlackGamebot
module Commands
class Subscription < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'subscription' do |client, data, _match|
user = ::User.find_create_or_update_by_slack_id!(client, data.user)
team = ::Team.find... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/season.rb | slack-gamebot/commands/season.rb | module SlackGamebot
module Commands
class Season < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'season' do |client, data, _match|
if client.owner.matches.current.any? || client.owner.challenges.current.any?
current_season = ::... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/unregister.rb | slack-gamebot/commands/unregister.rb | module SlackGamebot
module Commands
class Unregister < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'unregister' do |client, data, match|
if !match['expression'] || match['expression'] == 'me'
user = ::User.find_create_or_updat... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/demote.rb | slack-gamebot/commands/demote.rb | module SlackGamebot
module Commands
class Demote < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'demote' do |client, data, match|
user = ::User.find_create_or_update_by_slack_id!(client, data.user)
if !match['expression'] || matc... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/default.rb | slack-gamebot/commands/default.rb | module SlackGamebot
module Commands
class Default < SlackRubyBot::Commands::Base
match(/^(?<bot>\w*)$/)
def self.call(client, data, _match)
client.say(channel: data.channel, text: SlackGamebot::INFO)
client.say(channel: data.channel, gif: 'robot')
end
end
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/lost.rb | slack-gamebot/commands/lost.rb | module SlackGamebot
module Commands
class Lost < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'lost' do |client, data, match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
expression = match['expressio... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/taunt.rb | slack-gamebot/commands/taunt.rb | module SlackGamebot
module Commands
class Taunt < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'taunt' do |client, data, match|
taunter = ::User.find_create_or_update_by_slack_id!(client, data.user)
arguments = match['expression'... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/draw.rb | slack-gamebot/commands/draw.rb | module SlackGamebot
module Commands
class Draw < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'draw' do |client, data, match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
expression = match['expressio... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/decline.rb | slack-gamebot/commands/decline.rb | module SlackGamebot
module Commands
class Decline < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'decline' do |client, data, _match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
challenge = ::Challeng... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/challenge.rb | slack-gamebot/commands/challenge.rb | module SlackGamebot
module Commands
class Challenge < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'challenge' do |client, data, match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
arguments = match['... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/challenges.rb | slack-gamebot/commands/challenges.rb | module SlackGamebot
module Commands
class Challenges < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'challenges' do |client, data, _match|
challenges = ::Challenge.where(
channel: data.channel,
:state.in => [
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/set.rb | slack-gamebot/commands/set.rb | module SlackGamebot
module Commands
class Set < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
class << self
def set_nickname(client, data, user, v)
target_user = user
slack_mention = v.split.first if v
if v && User.slack_mentio... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/resigned.rb | slack-gamebot/commands/resigned.rb | module SlackGamebot
module Commands
class Resigned < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'resigned' do |client, data, match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
expression = match['e... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/promote.rb | slack-gamebot/commands/promote.rb | module SlackGamebot
module Commands
class Promote < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'promote' do |client, data, match|
user = ::User.find_create_or_update_by_slack_id!(client, data.user)
arguments = match['expression... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/cancel.rb | slack-gamebot/commands/cancel.rb | module SlackGamebot
module Commands
class Cancel < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'cancel' do |client, data, _match|
player = ::User.find_create_or_update_by_slack_id!(client, data.user)
challenge = ::Challenge.find... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/help.rb | slack-gamebot/commands/help.rb | module SlackGamebot
module Commands
class Help < SlackRubyBot::Commands::Base
HELP = <<~EOS.freeze
I am your friendly Gamebot, here to help.
```
General
-------
hi: be nice, say hi to your bot
team: show your team's info and captains
register: re-regi... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/info.rb | slack-gamebot/commands/info.rb | module SlackGamebot
module Commands
class Info < SlackRubyBot::Commands::Base
def self.call(client, data, _match)
client.say(channel: data.channel, text: SlackGamebot::INFO)
logger.info "INFO: #{client.owner} - #{data.user}"
end
end
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/matches.rb | slack-gamebot/commands/matches.rb | module SlackGamebot
module Commands
class Matches < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'matches' do |client, data, match|
totals = {}
totals.default = 0
arguments = match['expression'].split.reject(&:blank?) if ... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/seasons.rb | slack-gamebot/commands/seasons.rb | module SlackGamebot
module Commands
class Seasons < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'seasons' do |client, data, _match|
current_season = ::Season.new(team: client.owner)
if current_season.valid?
message = [... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/unsubscribe.rb | slack-gamebot/commands/unsubscribe.rb | module SlackGamebot
module Commands
class Unsubscribe < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'unsubscribe' do |client, data, match|
user = ::User.find_create_or_update_by_slack_id!(client, data.user)
team = ::Team.find(cl... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/team.rb | slack-gamebot/commands/team.rb | module SlackGamebot
module Commands
class Team < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'team' do |client, data, _match|
::User.find_create_or_update_by_slack_id!(client, data.user)
captains = if client.owner.captains.count... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/challenge_question.rb | slack-gamebot/commands/challenge_question.rb | module SlackGamebot
module Commands
class ChallengeQuestion < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'challenge?' do |client, data, match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
arguments ... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/rank.rb | slack-gamebot/commands/rank.rb | module SlackGamebot
module Commands
class Rank < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'rank' do |client, data, match|
arguments = match['expression'].split.reject(&:blank?) if match['expression']
users = arguments || []
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/sucks.rb | slack-gamebot/commands/sucks.rb | module SlackGamebot
module Commands
class Sucks < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'sucks', 'suck', 'you suck', 'sucks!', 'you suck!' do |client, data, _match|
user = ::User.find_create_or_update_by_slack_id!(client, data.use... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/accept.rb | slack-gamebot/commands/accept.rb | module SlackGamebot
module Commands
class Accept < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'accept' do |client, data, _match|
challenger = ::User.find_create_or_update_by_slack_id!(client, data.user)
challenge = ::Challenge.... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/mixins.rb | slack-gamebot/commands/mixins.rb | require 'slack-gamebot/commands/mixins/subscription'
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/leaderboard.rb | slack-gamebot/commands/leaderboard.rb | module SlackGamebot
module Commands
class Leaderboard < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'leaderboard' do |client, data, match|
max = client.owner.leaderboard_max
reverse = false
arguments = match['expression'... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/register.rb | slack-gamebot/commands/register.rb | module SlackGamebot
module Commands
class Register < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'register' do |client, data, _match|
ts = Time.now.utc
user = ::User.find_create_or_update_by_slack_id!(client, data.user)
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/reset.rb | slack-gamebot/commands/reset.rb | module SlackGamebot
module Commands
class Reset < SlackRubyBot::Commands::Base
include SlackGamebot::Commands::Mixins::Subscription
subscribed_command 'reset' do |client, data, match|
user = ::User.find_create_or_update_by_slack_id!(client, data.user)
if !user.captain?
clien... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/commands/mixins/subscription.rb | slack-gamebot/commands/mixins/subscription.rb | module SlackGamebot
module Commands
module Mixins
module Subscription
extend ActiveSupport::Concern
module ClassMethods
def subscribed_command(*values, &)
command(*values) do |client, data, match|
if Stripe.api_key && client.owner.reload.subscription_expi... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/season.rb | slack-gamebot/models/season.rb | class Season
include Mongoid::Document
include Mongoid::Timestamps::Created
belongs_to :team, index: true
belongs_to :created_by, class_name: 'User', inverse_of: nil, index: true, optional: true
has_many :challenges
has_many :matches
embeds_many :user_ranks
after_create :archive_challenges!
after_cr... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/elo.rb | slack-gamebot/models/elo.rb | module Elo
DELTA_TAU = 0.94
MAX_TAU = 11
def self.team_elo(players)
(players.sum(&:elo).to_f / players.count).round(2)
end
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/user_rank.rb | slack-gamebot/models/user_rank.rb | class UserRank
include Mongoid::Document
belongs_to :user
field :user_name, type: String
field :wins, type: Integer, default: 0
field :losses, type: Integer, default: 0
field :elo, type: Integer, default: 0
field :elo_history, type: Array, default: []
field :tau, type: Float, default: 0
field :rank,... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/score.rb | slack-gamebot/models/score.rb | module Score
# returns loser, winner points
def self.points(scores)
winning = 0
losing = 0
scores.each do |score|
losing += score[0]
winning += score[1]
end
[losing, winning]
end
# loser scores first
def self.valid?(scores)
scores.count { |score| score[0] < score[1] } > sc... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/game.rb | slack-gamebot/models/game.rb | class Game
include Mongoid::Document
include Mongoid::Timestamps
SORT_ORDERS = ['created_at', '-created_at', 'updated_at', '-updated_at'].freeze
field :name, type: String
index(name: 1)
field :bot_name, type: String
field :client_id, type: String
field :client_secret, type: String
field :aliases, t... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/challenge.rb | slack-gamebot/models/challenge.rb | class Challenge
include Mongoid::Document
include Mongoid::Timestamps
index(state: 1, channel: 1)
SORT_ORDERS = ['created_at', '-created_at', 'updated_at', '-updated_at', 'state', '-state', 'channel', '-channel'].freeze
field :state, type: String, default: ChallengeState::PROPOSED
field :channel, type: S... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/match.rb | slack-gamebot/models/match.rb | class Match
include Mongoid::Document
include Mongoid::Timestamps
SORT_ORDERS = ['created_at', '-created_at'].freeze
belongs_to :team, index: true
field :tied, type: Boolean, default: false
field :resigned, type: Boolean, default: false
field :scores, type: Array
belongs_to :challenge, index: true, op... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/challenge_state.rb | slack-gamebot/models/challenge_state.rb | class ChallengeState
include Ruby::Enum
define :PROPOSED, 'proposed'
define :ACCEPTED, 'accepted'
define :DECLINED, 'declined'
define :CANCELED, 'canceled'
define :DRAWN, 'drawing'
define :PLAYED, 'played'
end
| ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/team.rb | slack-gamebot/models/team.rb | class Team
field :gifs, type: Boolean, default: true
field :api, type: Boolean, default: false
field :aliases, type: Array, default: []
field :dead_at, type: DateTime
field :trial_informed_at, type: DateTime
field :elo, type: Integer, default: 0
field :unbalanced, type: Boolean, default: false
field :le... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/models/user.rb | slack-gamebot/models/user.rb | class User
include Mongoid::Document
include Mongoid::Timestamps
field :user_id, type: String
field :user_name, type: String
field :wins, type: Integer, default: 0
field :losses, type: Integer, default: 0
field :losing_streak, type: Integer, default: 0
field :winning_streak, type: Integer, default: 0
... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/api/presenters.rb | slack-gamebot/api/presenters.rb | require 'roar/representer'
require 'roar/json'
require 'roar/json/hal'
require 'slack-gamebot/api/presenters/paginated_presenter'
require 'slack-gamebot/api/presenters/status_presenter'
require 'slack-gamebot/api/presenters/challenge_presenter'
require 'slack-gamebot/api/presenters/challenges_presenter'
require 'slack... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/api/middleware.rb | slack-gamebot/api/middleware.rb | module Api
class Middleware
def self.logger
@logger ||= begin
$stdout.sync = true
Logger.new(STDOUT)
end
end
def self.instance
@instance ||= Rack::Builder.new do
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any,... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
dblock/slack-gamebot | https://github.com/dblock/slack-gamebot/blob/0af9dc9bf8c61523ed46c1007a96a3c9daa488c8/slack-gamebot/api/endpoints.rb | slack-gamebot/api/endpoints.rb | require 'slack-gamebot/api/endpoints/challenges_endpoint'
require 'slack-gamebot/api/endpoints/matches_endpoint'
require 'slack-gamebot/api/endpoints/users_endpoint'
require 'slack-gamebot/api/endpoints/seasons_endpoint'
require 'slack-gamebot/api/endpoints/subscriptions_endpoint'
require 'slack-gamebot/api/endpoints/t... | ruby | MIT | 0af9dc9bf8c61523ed46c1007a96a3c9daa488c8 | 2026-01-04T17:48:57.592423Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.