Class: Heathrow::Wizards::DiscordWizard
- Inherits:
-
Object
- Object
- Heathrow::Wizards::DiscordWizard
- Defined in:
- lib/heathrow/wizards/discord_wizard.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source = nil) ⇒ DiscordWizard
constructor
A new instance of DiscordWizard.
- #run ⇒ Object
Constructor Details
#initialize(source = nil) ⇒ DiscordWizard
Returns a new instance of DiscordWizard.
15 16 17 18 |
# File 'lib/heathrow/wizards/discord_wizard.rb', line 15 def initialize(source = nil) @source = source @config = source ? source.config : {} end |
Class Method Details
.run(source = nil) ⇒ Object
11 12 13 |
# File 'lib/heathrow/wizards/discord_wizard.rb', line 11 def self.run(source = nil) new(source).run end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/heathrow/wizards/discord_wizard.rb', line 20 def run puts "\n=== Discord Configuration Wizard ===" puts # Get token token = get_token return nil unless token # Test token is_bot = test_token(token) return nil unless is_bot @config['token'] = token @config['is_bot'] = is_bot # Discover servers and channels puts "\nDiscovering servers and channels..." discover_and_select_channels(token, is_bot) # Set other options @config['fetch_limit'] ||= 50 @config['polling_interval'] ||= 300 puts "\n=== Configuration Complete ===" puts "Token: #{token[0..20]}..." puts "Bot account: #{is_bot ? 'Yes' : 'No'}" puts "Channels: #{@config['channels'].split(',').length} selected" if @config['channels'] puts "Guilds: #{@config['guilds'].split(',').length} selected" if @config['guilds'] && !@config['guilds'].empty? @config end |