From 3df776f019154a607cda443eb52aeae3eabbb1b1 Mon Sep 17 00:00:00 2001 From: freyamade Date: Wed, 13 Mar 2019 01:19:29 +0000 Subject: [PATCH] No longer need channel id to be set in the env --- .env.sample.bash | 2 -- .env.sample.fish | 2 -- README.md | 2 -- src/config.cr | 18 ------------------ 4 files changed, 24 deletions(-) diff --git a/.env.sample.bash b/.env.sample.bash index 29892fc..b154fef 100644 --- a/.env.sample.bash +++ b/.env.sample.bash @@ -1,7 +1,5 @@ # Sample environment file for use in the bash shell -# channel_id -export CRCOPHONY_CHANNEL_ID="" # token export CRCOPHONY_TOKEN="" # user id diff --git a/.env.sample.fish b/.env.sample.fish index 15e668d..20e91ba 100644 --- a/.env.sample.fish +++ b/.env.sample.fish @@ -1,7 +1,5 @@ # Sample environment file for use in the fish shell -# channel_id -set -x CRCOPHONY_CHANNEL_ID "" # token set -x CRCOPHONY_TOKEN "" # user id diff --git a/README.md b/README.md index e7da6e8..25952a2 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,11 @@ If you run into any issues, check the `.log` files that have been created. If an To use the system, you must gather the following information and export the data as environment variables. These variables are as follows; -- `CRCOPHONY_CHANNEL_ID`: The ID of the channel you wish to connect to (temporary, will be removed once I have sorted out the channel switching functionality) - `CRCOPHONY_TOKEN`: Your user token used to authenticate yourself with the client - `CRCOPHONY_USER_ID`: Your user id (might not be necessary, requires investigation and could be removed at a later point) Here are the instructions for you to get these bits of data; 1. Turn on [Developer Mode](https://discordia.me/developer-mode) -2. To get the `channel_id`, right click on the channel you want to join and click "Copy ID". This is the value you should put in as the `channel_id` 3. To get the `user_id`, right click on your own name in the Users sidebar of any channel and click "Copy ID". This is the value you should put in as the `user_id` 4. Follow [this guide](https://discordhelp.net/discord-token) to get your token. diff --git a/src/config.cr b/src/config.cr index 3f9815c..7da4c1a 100644 --- a/src/config.cr +++ b/src/config.cr @@ -4,17 +4,13 @@ module Crcophony # Environment variable config loader class class Config # Env key names - @@CHANNEL_ID_KEY = "CRCOPHONY_CHANNEL_ID" @@TOKEN_KEY = "CRCOPHONY_TOKEN" @@USER_ID_KEY = "CRCOPHONY_USER_ID" # Config variables - @channel_id : UInt64 @token : String @user_id : UInt64 - # The ID of the channel to connect to (will be removed as soon as channel switching is implemented) - getter channel_id # The user token used to log in getter token # The user id (isn't necessary to specify initially so I might get rid of this requirement) @@ -22,20 +18,6 @@ module Crcophony # Attempt to load configuration from the environment def initialize - # Channel ID - if ENV[@@CHANNEL_ID_KEY]? - channel_id = ENV[@@CHANNEL_ID_KEY] - if channel_id.to_u64? - @channel_id = channel_id.to_u64 - else - puts "Crcophony Config Error: Could not load `#{@@CHANNEL_ID_KEY}` as it is not a valid 64 bit unsigned integer.".colorize :red - Process.exit 1 - end - else - puts "Crcophony Config Error: Could not load `#{@@CHANNEL_ID_KEY}`. Have you set the environment variable?".colorize :red - Process.exit 1 - end - # User token if ENV[@@TOKEN_KEY]? @token = ENV[@@TOKEN_KEY]