Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ninthy opened this issue Nov 20, 2023 · 0 comments

Comments

@ninthy
Copy link

ninthy commented Nov 20, 2023


    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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant