Eric-Guo / wechat

API, command and message handling for WeChat in Rails
MIT License
1.31k stars 372 forks source link

An error occurred with wechat command-line 1st attempt #307

Closed caryyu closed 2 years ago

caryyu commented 2 years ago

The installation steps I've made are:

  1. gem install wechat
  2. gem install rails

BTW: I took a search and found a reference about symbolize_keys related issue here https://stackoverflow.com/questions/27627663/nomethoderror-undefined-method-symbolize-keys-for-hash, I have no idea whether it is relevant to this since I tried and failed either

WARNING: If using 'Rails.application.credentials.wechat_secret!' in wechat.yml, you need run in 'rails c' and access via 'Wechat.api' or gem 'figaro' instead.
Traceback (most recent call last):
        6: from /home/caryyu/.rbenv/versions/2.7.4/bin/wechat:23:in `<main>'
        5: from /home/caryyu/.rbenv/versions/2.7.4/bin/wechat:23:in `load'
        4: from /home/caryyu/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/wechat-0.14.0/bin/wechat:13:in `<top (required)>'
        3: from /home/caryyu/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/wechat-0.14.0/bin/wechat:36:in `<class:App>'
        2: from /home/caryyu/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/wechat-0.14.0/lib/wechat/api_loader.rb:7:in `with'
        1: from /home/caryyu/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/wechat-0.14.0/lib/wechat/api_loader.rb:33:in `config'
/home/caryyu/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/wechat-0.14.0/lib/wechat/api_loader.rb:45:in `loading_config!': undefined method `symbolize_keys!' for {:default=>nil}:Hash (NoMethodError)
Eric-Guo commented 2 years ago

run rails credentials:edit and filling the wechat_secret as error reported if you are in some rails project, you may need to running rails new test_wechat_app to create one first.

caryyu commented 2 years ago

In fact, I had my config set at ~/.wechat.yml already according to the instruction, is there still necessary to do credential edit again?

caryyu commented 2 years ago

Hi @Eric-Guo, I'm a little bit confused about the command-line installation, from my understanding, If we want to utilize this project as a cli tool, we don't need to create a new project, is that right? the only things we need to do are to have gem packages installed and configure ~/.wechat.yml in advance before getting wechat run in terminal, please correct me if my speculation is wrong

Eric-Guo commented 2 years ago

It's original think useful, but after you got many rails project, you always running command line in one of the rails projects. so I will remove this feature in future.

Eric-Guo commented 2 years ago

Anyway the v0.15.0 fix it.