Code Monkey home page Code Monkey logo

bot's Issues

relation "users" does not exist

I am deploying a bot using docker-compose and every time I deploy it I see this error and of course the bot is not processing any messages.

Screenshot_110

Do not make banned channels' usernames clickable

Currently when a channel is banned, it's username is posted with leading @, making it clickable, which helps promoting such channels.
I suggest removing the @ symbol so chat user won't be able to open that channel instantly.

Later another rule can be applied which replaces some symbols in usernames with asterisks (*)

dockerized bot shuts down ungracefully

Using entrypoint causes docker to spawn another process to execute python, and it doesn't receive stop signals. This leaves on_shutdown events unexecuted.

The command `!set_superuser` won't work

@dp.message_handler(commands=["set_superuser"], commands_prefix="!", is_superuser=True)

In the first lines of the function above, you check the user_id is existed by calling get_args method of the message. The check always returns false.
The method message.get_args() returns an argument only if it command that starts with /.

Trace:
message.get_args() -> message.get_full_command() -> message.is_command() -> return self.text and self.text.startswith("/")

Ban user after three failed captcha attempts

Some userbots are trying to join and spam too much "xxx joined the group" when they fail captcha. I suggest banning user who failed captcha three times in a row to prevent a "wall" of join messages.

image

TypeError: 'datetime.time' object is not iterable in command start

Handled this exception when user click /start in private chat with bot.
How is possible?

2019-10-20 18:27:03.410 | INFO     | aiogram.contrib.middlewares.logging:on_post_process_update:34 - Process update [ID:773110463]: [success] (in 8 ms)
         └ <click.core.Group object at 0x7f1ddfeb17d0>
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
           │               │       │       │      └ <click.core.Context object at 0x7f1de2ac7c10>
           │               │       │       └ <function Command.invoke at 0x7f1de2a03f80>
           │               │       └ <click.core.Command object at 0x7f1ddfd31e90>
           │               └ <click.core.Context object at 0x7f1de2ac7c10>
           └ <function MultiCommand.invoke.<locals>._process_result at 0x7f1de2b72cb0>
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'skip_updates': False, 'autoreload': False}
           │   │      │    │           └ <click.core.Context object at 0x7f1de2ac7c10>
           │   │      │    └ <function polling at 0x7f1de10924d0>
           │   │      └ <click.core.Command object at 0x7f1ddfd31e90>
           │   └ <function Context.invoke at 0x7f1de2a03170>
           └ <click.core.Context object at 0x7f1de2ac7c10>
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
           │         │       └ {'skip_updates': False, 'autoreload': False}
           │         └ ()
           └ <function polling at 0x7f1de10924d0>


  File "/app/app/utils/cli.py", line 51, in polling
    runner.start_polling(reset_webhook=True)
    │      └ <function Executor.start_polling at 0x7f1de060add0>
    └ <aiogram.utils.executor.Executor object at 0x7f1ddf4f0b90>


  File "/usr/local/lib/python3.7/site-packages/aiogram/utils/executor.py", line 308, in start_polling
    loop.run_forever()
    │    └ <method 'run_forever' of 'uvloop.loop.Loop' objects>
    └ <uvloop.Loop running=True closed=False debug=False>
  File "/usr/local/lib/python3.7/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
                     │           │        │       └ {}
                     │           │        └ (<aiogram.types.update.Update object at 0x7f1ddc872d10>,)
                     │           └ <bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f1de147f050>>
                     └ Handler.HandlerObj(handler=<bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7...
  File "/usr/local/lib/python3.7/site-packages/aiogram/dispatcher/dispatcher.py", line 223, in process_update
    err = await self.errors_handlers.notify(update, e)
                │    │               │      │       └ TypeError("'datetime.time' object is not iterable")
                │    │               │      └ <aiogram.types.update.Update object at 0x7f1ddc872d10>
                │    │               └ <function Handler.notify at 0x7f1de05e4440>
                │    └ <aiogram.dispatcher.handler.Handler object at 0x7f1de147f390>
                └ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f1de147f050>
  File "/usr/local/lib/python3.7/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
                     │           │        │       └ {}
                     │           │        └ (<aiogram.types.update.Update object at 0x7f1ddc872d10>, TypeError("'datetime.time' object is not iterable"))
                     │           └ <function errors_handler at 0x7f1de14920e0>
                     └ Handler.HandlerObj(handler=<function errors_handler at 0x7f1de14920e0>, spec=FullArgSpec(args=['update', 'exception'], vararg...


> File "/app/app/handlers/base.py", line 27, in errors_handler
    raise exception
          └ TypeError("'datetime.time' object is not iterable")


  File "/usr/local/lib/python3.7/site-packages/aiogram/dispatcher/dispatcher.py", line 192, in process_update
    return await self.message_handlers.notify(update.message)
                 │    │                │      │      └ <aiogram.types.fields.Field object at 0x7f1de054b810>
                 │    │                │      └ <aiogram.types.update.Update object at 0x7f1ddc872d10>
                 │    │                └ <function Handler.notify at 0x7f1de05e4440>
                 │    └ <aiogram.dispatcher.handler.Handler object at 0x7f1de147f110>
                 └ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f1de147f050>
  File "/usr/local/lib/python3.7/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
                     │           │        │       └ {'user': <app.models.user.User object at 0x7f1ddc872710>}
                     │           │        └ (<aiogram.types.message.Message object at 0x7f1ddc872cd0>,)
                     │           └ <function cmd_start at 0x7f1de1492050>
                     └ Handler.HandlerObj(handler=<function cmd_start at 0x7f1de1492050>, spec=FullArgSpec(args=['message', 'user'], varargs=None, v...


  File "/app/app/handlers/base.py", line 16, in cmd_start
    user=md.quote_html(message.from_user.full_name),
    │    │  │          │       └ <aiogram.types.fields.Field object at 0x7f1de05e83d0>
    │    │  │          └ <aiogram.types.message.Message object at 0x7f1ddc872cd0>
    │    │  └ <function quote_html at 0x7f1ddfe3a5f0>
    │    └ <module 'aiogram.utils.markdown' from '/usr/local/lib/python3.7/site-packages/aiogram/utils/markdown.py'>
    └ <app.models.user.User object at 0x7f1ddc872710>


  File "/usr/local/lib/python3.7/site-packages/aiogram/utils/markdown.py", line 51, in quote_html
    for symbol in content:
                  └ datetime.time(21, 59, 17, tzinfo=datetime.timezone.utc)


TypeError: 'datetime.time' object is not iterable

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.