GithubHelp home page GithubHelp logo

dmcallejo / asfbot Goto Github PK

View Code? Open in Web Editor NEW
40.0 2.0 10.0 69 KB

Control your ArchiSteamFarm with Telegram

License: GNU General Public License v3.0

Python 99.31% Dockerfile 0.69%
bot asf archisteamfarm telegram linux docker telegrambot python python3 hacktoberfest

asfbot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

asfbot's Issues

Is there any way to make the bot take commands from a group?

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.

Cann't start ASFBot

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'}

ASFBot - CRITICAL - Couldn't communicate with ASF. Host: 'asf' Port: '1242'

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'))

Segment long messages sent to Telegram to avoid API length limitation

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

Got the Entity error. This is most likely due to parse_mode.

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 Connection not working

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

Automatic shutdown of the bot when any Python error occurs.

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.

Bot won't start

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='*'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.