Code Monkey home page Code Monkey logo

pyrogram-cooldown's Introduction

See my Valorant's statistic here
Image above was generated by this magic code.


Hi there ๐Ÿ‘‹๐Ÿ˜„

I'm Kiizuha Kanazawa (23 y.o)! I live in Tangerang, Indonesia. ๐Ÿ˜‹
I'd love to create project that has relation to games or anything I like now.

๐Ÿ’ป I'm currently learning:

JavaScript TypeScript VueJS Flutter Go Reverse Engineering

๐Ÿ›  Tools that I'm using:

GIT Visual Studio Code IDA Pro dnSpy Pro HTTP Toolkit Windows Docker

๐Ÿ’ก My projects:

๐Ÿ† Github Stats

๐Ÿค™ Reach me on:

pyrogram-cooldown's People

Contributors

rushkii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyrogram-cooldown's Issues

TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'int'


    if msg.date >= data[user_id]['timestamp'] + flt.data:
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'int'

can be fixed by
if msg.date >= data[user_id]['timestamp'] + timedelta(seconds=flt.data):
on line 24 on cooldown.py
and on line 3
from datetime import datetime, timedelta

and you can change the task function to this for nice animation

async def task(msg, warn = False, sec = None):
    if warn:
        user = msg.from_user
        ids = await msg.reply(f"Sorry {user.mention}, you're in cooldown now, wait for `{sec}`s to use command again..")
        for i in range(sec):
            
            await ids.edit(f"Sorry {user.mention}, you're in cooldown now, wait for `{sec-(i+1)}`s to use command again..")
            await asyncio.sleep(1)

        
        await ids.edit(f"Alright {user.mention}, your cooldown is over you can command again.")
        await asyncio.sleep(3)
        await ids.delete()

NameError: name 'filters' is not defined

I got this error while running the examples

Pyrogram v1.2.9, Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)

Traceback (most recent call last):
  File "run.py", line 19, in <module>
    bot.start()
  File "/usr/local/lib/python3.8/dist-packages/pyrogram/sync.py", line 56, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/dist-packages/pyrogram/methods/utilities/start.py", line 68, in start
    await self.initialize()
  File "/usr/local/lib/python3.8/dist-packages/pyrogram/methods/auth/initialize.py", line 44, in initialize
    self.load_plugins()
  File "/usr/local/lib/python3.8/dist-packages/pyrogram/client.py", line 736, in load_plugins
    module = import_module(module_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/aziz/pyrogram-cooldown/plugins/echo.py", line 6, in <module>
    @bot.on_message(filters.command(['test']) & cooldown.wait(5))
  File "/home/aziz/pyrogram-cooldown/plugins/utils/cooldown.py", line 36, in wait
    return filters.create(___, data=sec)
NameError: name 'filters' is not defined

It's can be fixed by importing pyrogram.filters on cooldown.py

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.