Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增telegram bot指定发送chat id #184

Merged
merged 5 commits into from
Apr 17, 2022
Merged

Conversation

chenyc1995
Copy link
Contributor

当设置 'telebot_use_chat_id'为 true 时,bot信息将会发送至指定chat id目标。
chat id获取方法
private channel id获取方法

@miyouzi
Copy link
Owner

miyouzi commented Apr 17, 2022

@ch010060 Please check

@ch010060
Copy link
Contributor

概念沒有問題
可是code有問題

  1. 缺少逗號 ,
    Config.py: line 129
    Config.py

建議改成

'telebot_use_chat_id': False,
  1. 判定不嚴謹加上telebot_chat_id變數有打錯
    Anime.py: line 914~915
    Anime.py

建議改成

 if self._settings['telebot_use_chat_id'] and self._settings['telebot_chat_id']: #手动指定发送目标
     chat_id = self._settings['telebot_chat_id']

@chenyc1995
Copy link
Contributor Author

已看到错误,请教“判定不嚴謹”是怎么说?

@ch010060
Copy link
Contributor

如果user設定了使用chat_id可是chat_id是空值
這樣不會用到原本預設的chat_id,就無法成功送出message了
所以建議檢查true且非空

@chenyc1995
Copy link
Contributor Author

了解,然后好像原来的代码已经不能找出正确的chat id了,那方面我不太熟悉

@chenyc1995
Copy link
Contributor Author

已经修改好了,麻烦审阅

@ch010060
Copy link
Contributor

了解,然后好像原来的代码已经不能找出正确的chat id了,那方面我不太熟悉

因為根據原本TG通知的PR
需要先跟bot對話(/start)才能有初始chat_id

已经修改好了,麻烦审阅

根據最後改動,可以正常work了

@miyouzi miyouzi merged commit 9edebbb into miyouzi:master Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants