dmcallejo / asfbot Goto Github PK
View Code? Open in Web Editor NEWControl your ArchiSteamFarm with Telegram
License: GNU General Public License v3.0
Control your ArchiSteamFarm with Telegram
License: GNU General Public License v3.0
Basically, i want the bot to be able to take commands from another bot.
I want a specific command sent once every hour and i am not sure how to do that, other than setting up another bot to send that command to a channel (I can't send to the ASFBot because, Telegram bots cannot send messages to other bots.
2023-02-02 05:40:25,799 - ASFBot - INFO - Starting up bot... 2023-02-02 05:40:26,378 - ASFBot.IPCProtocol - ERROR - Error Requesting http://asf:1242/Api/ASF with parameters {} 2023-02-02 05:40:26,378 - ASFBot.IPCProtocol - ERROR - 401 Client Error: Unauthorized for url: http://asf:1242/Api/ASF Traceback (most recent call last): File "/bot/IPCProtocol/__init__.py", line 37, in get response.raise_for_status() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://asf:1242/Api/ASF 2023-02-02 05:40:26,381 - ASFBot - INFO - ASF Instance replied: 401 Client Error: Unauthorized for url: http://asf:1242/Api/ASF 2023-02-02 05:40:26,381 - ASFBot - WARNING - ASF Instance message was unsuccesful. {'Success': False, 'Message': '401 Client Error: Unauthorized for url: http://asf:1242/Api/ASF'}
This Script Dont need PW from IPC?
Hello,
I'm getting the same error as this issue :
#2
asfbot | 2022-01-06 19:24:56,357 - ASFBot - INFO - Starting up bot...
asfbot | 2022-01-06 19:24:56,366 - ASFBot - CRITICAL - Couldn't communicate with ASF. Host: 'asf' Port: '1242'
asfbot | HTTPConnectionPool(host='asf', port=1242): Max retries exceeded with url: /Api/ASF (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8e7f55a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
I keep getting the error.
I can access localhost:1242/api/asf on my host computer.
Is there anything I can try to fix this?
When the bot has a long message to send to the user it may reach the API limit leaving the user without response. See stacktrace below.
To avoid this, a good solution might be process all sent messages and segment them in several chained messages (each message as a reply of the one it came before).
2022-12-19 10:25:33,001 (__init__.py:986 MainThread) ERROR - TeleBot: "Threaded polling exception: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is too long"
2022-12-19 10:25:33,001 (__init__.py:988 MainThread) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):
File "/bot/bot.py", line 190, in reply_to
bot.reply_to(message, text, parse_mode="html", **kwargs)
File "/usr/local/lib/python3.10/site-packages/telebot/__init__.py", line 4074, in reply_to
return self.send_message(message.chat.id, text, reply_to_message_id=message.message_id, **kwargs)
File "/usr/local/lib/python3.10/site-packages/telebot/__init__.py", line 1451, in send_message
apihelper.send_message(
File "/usr/local/lib/python3.10/site-packages/telebot/apihelper.py", line 276, in send_message
return _make_request(token, method_url, params=payload, method='post')
File "/usr/local/lib/python3.10/site-packages/telebot/apihelper.py", line 161, in _make_request
json_result = _check_result(method_name, result)
File "/usr/local/lib/python3.10/site-packages/telebot/apihelper.py", line 188, in _check_result
raise ApiTelegramException(method_name, result, result_json)
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is too long
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/telebot/__init__.py", line 977, in __threaded_polling
self.worker_pool.raise_exceptions()
File "/usr/local/lib/python3.10/site-packages/telebot/util.py", line 154, in raise_exceptions
raise self.exception_info
File "/usr/local/lib/python3.10/site-packages/telebot/util.py", line 98, in run
task(*args, **kwargs)
File "/bot/bot.py", line 169, in command_handler
reply_to(message, response)
File "/bot/bot.py", line 192, in reply_to
bot.reply_to(message, "There was a Telegram error sending the message:\n" + text +
File "/usr/local/lib/python3.10/site-packages/telebot/__init__.py", line 4074, in reply_to
return self.send_message(message.chat.id, text, reply_to_message_id=message.message_id, **kwargs)
File "/usr/local/lib/python3.10/site-packages/telebot/__init__.py", line 1451, in send_message
apihelper.send_message(
File "/usr/local/lib/python3.10/site-packages/telebot/apihelper.py", line 276, in send_message
return _make_request(token, method_url, params=payload, method='post')
File "/usr/local/lib/python3.10/site-packages/telebot/apihelper.py", line 161, in _make_request
json_result = _check_result(method_name, result)
File "/usr/local/lib/python3.10/site-packages/telebot/apihelper.py", line 188, in _check_result
raise ApiTelegramException(method_name, result, result_json)
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is too long
C:\ASFBot-master>python bot.py --token token --alias alias --host host --port 1242 --password ipc_password
2020-12-29 16:50:56,735 - ASFBot - INFO - Starting up bot...
2020-12-29 16:50:56,759 - ASFBot - INFO - ASF Instance replied: OK
2020-12-29 16:51:00,497 - ASFBot - INFO - Command: !status. Response: <bot> The bot doesn't farm anything.
2020-12-29 16:51:00,658 (__init__.py:489 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 7"
asfbot | 2019-09-10 22:02:39,374 - ASFBot - DEBUG - Logger initialized
asfbot | 2019-09-10 22:02:39,377 - ASFBot - INFO - Starting up bot...
asfbot | 2019-09-10 22:02:39,449 - ASFBot - CRITICAL - Couldn't communicate with ASF. Host: 'asf' Port: '1242'
asfbot | 404 Client Error: Not Found for url: http://asf:1242/Api/Command/status+ASF
If any error occurs related to the bot code, the .py
file is automatically turned off, after which you need to enter python bot.py --token...
.
This causes a problem if the bot is running on Heroku or any other cloud.
This would make it much easier to work on cloud services, because the bot would always be running and you wouldn't have to restart it after any error.
It would be better if, for example, when a user writes !status
to a bot in a telegram, the console says "ASF is not running" or "Unable to connect to the specified host" and waited for the new command. Instead, the bot just crashes with an error Failed to estabilish a new connection: The connection is not established because the destination computer rejected the connection request
and you have to run it again.
Hey,
so as seen in the Logs the Bot just won't start. Did I do anything wrong?
Thanks for any help
Logs:
Traceback (most recent call last):
File "/bot/bot.py", line 86, in <module>
args.proxy = args.proxy.strip()
AttributeError: 'NoneType' object has no attribute 'strip'
Compose File:
version: '3.2'
services:
asf:
image: justarchi/archisteamfarm
container_name: asf
hostname: asf
restart: unless-stopped
environment:
- ASF_ARGS=--server
ports:
- 1242:1242
volumes:
- /var/lib/docker/volumes/asf/_data/ASF/config:/app/config
- /var/lib/docker/volumes/asf/_data/ASF/plugins:/app/plugins/custom
asfbot:
image: ghcr.io/dmcallejo/asfbot
container_name: asfbot
hostname: asfbot
restart: unless-stopped
command: --host asf
environment:
- TELEGRAM_BOT_TOKEN='*'
- TELEGRAM_USER_ALIAS='*'
- ASF_IPC_HOST='*'
- ASF_IPC_PORT='*'
- ASF_IPC_PASSWORD='*'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.