Esempio n. 1
0
async def update_message(bot, message_id, content):
    if is_cache_enabled(bot) and not Object(
            message_id).created_at <= datetime.utcfromtimestamp(time.time() -
                                                                5 * 60):
        await bot.redis_pool.hmset_dict(message_id, content=content)
    LoggedMessage.update(content=content).where(
        LoggedMessage.messageid == message_id).execute()
Esempio n. 2
0
async def update_message(bot, message_id, content, pinned):
    if is_cache_enabled(bot) and not Object(
            message_id).created_at <= datetime.utcfromtimestamp(time.time() -
                                                                5 * 60):
        pipe = bot.redis_pool.pipeline()
        pipe.hmset_dict(f"messages:{message_id}", content=content)
        pipe.hmset_dict(f"messages:{message_id}", pinned=(1 if pinned else 0))
        await pipe.execute()
    LoggedMessage.update(
        content=content,
        pinned=pinned).where(LoggedMessage.messageid == message_id).execute()