Module: Rubydium::Mixins::ControlFlow

Defined in:
lib/rubydium/mixins/control_flow.rb

Overview

These methods encapsulate common logic in control flow structures a bot will probably have.

Instance Method Summary collapse

Instance Method Details

#must_be_ownerObject



8
9
10
11
12
# File 'lib/rubydium/mixins/control_flow.rb', line 8

def must_be_owner
  return not_from_owner unless @user.username == config.owner_username

  yield
end

#must_be_privilegedObject



20
21
22
23
24
# File 'lib/rubydium/mixins/control_flow.rb', line 20

def must_be_privileged
  return not_from_privileged unless config.privileged_usernames.include?(@user.username)

  yield
end

#must_be_replyObject



14
15
16
17
18
# File 'lib/rubydium/mixins/control_flow.rb', line 14

def must_be_reply
  return not_a_reply unless @replies_to

  yield
end