Class: Botwayrb::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/bwrb.rb

Instance Method Summary collapse

Instance Method Details

#get_app_idObject



23
24
25
26
27
28
29
# File 'lib/bwrb.rb', line 23

def get_app_id()
  if get_bot_info("type") == "slack"
    BotwatConfig["botway"]["bots"][get_bot_info("name")]["bot_app_token"]
  else
    BotwatConfig["botway"]["bots"][get_bot_info("name")]["bot_app_id"]
  end
end

#get_bot_info(value) ⇒ Object



13
14
15
16
17
# File 'lib/bwrb.rb', line 13

def get_bot_info(value)
  data = YAML.load_file(".botway.yaml")

  data["bot"][value]
end

#get_guild_id(serverName) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/bwrb.rb', line 31

def get_guild_id(serverName)
  if get_bot_info("type") != "discord"
    raise Error, "ERROR: This function/feature is only working with discord bots"
  else
    BotwatConfig["botway"]["bots"][get_bot_info("name")]["guilds"][serverName]["server_id"]
  end
end

#get_signing_secretObject



39
40
41
42
43
44
45
# File 'lib/bwrb.rb', line 39

def get_signing_secret()
  if get_bot_info("type") != "slack"
    raise Error, "ERROR: This function/feature is only working with slack bots"
  else
    BotwatConfig["botway"]["bots"][get_bot_info("name")]["signing_secret"]
  end
end

#get_tokenObject



19
20
21
# File 'lib/bwrb.rb', line 19

def get_token()
  BotwatConfig["botway"]["bots"][get_bot_info("name")]["bot_token"]
end