Class: Botwayrb::Core
- Inherits:
-
Object
- Object
- Botwayrb::Core
- Defined in:
- lib/botwayrb.rb
Instance Method Summary collapse
- #get_app_id ⇒ Object
- #get_bot_info(value) ⇒ Object
- #get_guild_id(serverName) ⇒ Object
- #get_signing_secret ⇒ Object
- #get_token ⇒ Object
Instance Method Details
#get_app_id ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/botwayrb.rb', line 27 def get_app_id() if get_bot_info("lang") != "ruby" raise Error, "ERROR: Your Bot language is not Ruby" else 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 end |
#get_bot_info(value) ⇒ Object
13 14 15 16 17 |
# File 'lib/botwayrb.rb', line 13 def get_bot_info(value) data = YAML.load_file(".botway.yaml") data["bot"][value] end |
#get_guild_id(serverName) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/botwayrb.rb', line 39 def get_guild_id(serverName) if get_bot_info("lang") != "ruby" raise Error, "ERROR: Your Bot language is not Ruby" elsif 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_secret ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/botwayrb.rb', line 49 def get_signing_secret() if get_bot_info("lang") != "ruby" raise Error, "ERROR: Your Bot language is not Ruby" elsif 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_token ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/botwayrb.rb', line 19 def get_token() if get_bot_info("lang") != "ruby" raise Error, "ERROR: Your Bot language is not Ruby" else BotwatConfig["botway"]["bots"][get_bot_info("name")]["bot_token"] end end |