Giter VIP home page Giter VIP logo

amanobot's Introduction

amanobot's People

Contributors

0xmelkor avatar alissonlauffer avatar aragaer avatar ayumukasuga avatar boxama avatar das7pad avatar deepsource-autofix[bot] avatar deepsourcebot avatar hoskeowl avatar jdaniloc avatar nickoala avatar quasiyoke avatar zumoshi avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

amanobot's Issues

What's an easy way to get ONLY the new messages from MessageLoop?

Hello,
Every time I start my bot it fetches all the messages from the telegram API queue. Is there a way to get only the messages from when the bot is started on?
For now the code to start the bot looks like this:

bot = amanobot.aio.DelegatorBot(TOKEN, [
pave_event_space()(
    per_chat_id(), create_open, MessageHandler, timeout=20),
])
loop = asyncio.get_event_loop()
loop.create_task(MessageLoop(bot).run_forever())
loop.run_forever()

And I would like to add an option to handle only the newest messages. Thanks in advance for the support!

Telegram Bot API 5.1

It was added the field "my_chat_member" and "chat_member" in the chat messages, so it's occuring the error:
Traceback (most recent call last): File "/home/XXXX/.asdf/installs/python/3.8.0/lib/python3.8/site-packages/amanobot/loop.py", line 70, in run_forever self._update_handler(update) File "/home/XXXX/.asdf/installs/python/3.8.0/lib/python3.8/site-packages/amanobot/loop.py", line 159, in <lambda> collectloop.input_queue.put(_extract_message(update)[1])) File "/home/XXXX/.asdf/installs/python/3.8.0/lib/python3.8/site-packages/amanobot/loop.py", line 107, in _extract_message key = _find_first_key(update, ['message', File "/home/XXXX/.asdf/installs/python/3.8.0/lib/python3.8/site-packages/amanobot/__init__.py", line 72, in _find_first_key raise KeyError('No suggested keys %s in %s' % (str(keys), str(d))) KeyError: "No suggested keys ['message', 'edited_message', 'poll', 'channel_post', 'edited_channel_post', 'callback_query', 'inline_query', 'chosen_inline_result', 'shipping_query', 'pre_checkout_query'] in {'update_id': 000000002, 'my_chat_member': {'chat': {'id': 0000000000, 'first_name': 'FIRSTNAME', 'username': 'USERNAME', 'type': 'private'}, 'actor': {'id': 0000000000, 'is_bot': False, 'first_name': 'FIRSTNAME', 'username': 'USERNAME'}, 'date': 1615254657, 'old_chat_member': {'user': {'id': 0000000001, 'is_bot': True, 'first_name': 'BOTNAME', 'username': 'BOTUSERNAME'}, 'status': 'member'}, 'new_chat_member': {'user': {'id': 0000000001, 'is_bot': True, 'first_name': 'BOTNAME', 'username': 'BOTUSERNAME'}, 'status': 'kicked', 'until_date': 0}}}"
It's needed to change the suggested keys.

Publish release update

  1. Since master branch supports newer bot API, would be good to publish it as a release too

  2. Might also be good to update doco (as there are things like ChatMemberUpdated to be added to doco).

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.