Exemple #1
0
async def duty_signal(message: Message, prefix: str, user_id: int, signal: str, **kwargs):
    db = Database.get_current()
    if user_id != await message.api.user_id:
        return
    message_ = message.dict()
    __model = {
        "user_id": await message.api.user_id,
        "method": "lpSendSignal",
        "secret": db.secret_code,
        "message": {
            "conversation_message_id": message_['conversation_message_id'],
            "from_id": message_['from_id'],
            "date": message.date,
            "text": prefix + ' ' + signal,
            "peer_id": message.peer_id
        },
        "object": {
            "chat": None,
            "from_id": message_['from_id'],
            "value": prefix + ' ' + signal,
            "conversation_message_id": message_['conversation_message_id']
        },
        "vkmessage": message_
    }
    await send_request(__model)
Exemple #2
0
async def send_signal(database: Database,
                      message: Message,
                      alias: Alias,
                      separator: str = ' ',
                      signal: Optional[str] = None):
    message_ = message.dict()
    prepared_text = database.self_prefixes[0] + ' ' + alias.command_to
    prepared_text += f"{separator}{signal}" if signal else ''

    __model = {
        "user_id": message_['from_id'],
        "method": "lpSendMySignal",
        "secret": database.secret_code,
        "message": {
            "conversation_message_id": message_['conversation_message_id'],
            "from_id": message_['from_id'],
            "date": message.date,
            "text": prepared_text,
            "peer_id": message.peer_id
        },
        "object": {
            "chat": None,
            "from_id": message_['from_id'],
            "value": prepared_text,
            "conversation_message_id": message_['conversation_message_id']
        },
        "vkmessage": message_
    }

    await send_request(__model)
Exemple #3
0
async def self_signal(message: Message, prefix: str, signal: str):
    db = Database.get_current()
    message_ = message.dict()
    __model = {
        "user_id": message_['from_id'],
        "method": "lpSendMySignal",
        "secret": db.secret_code,
        "message": {
            "conversation_message_id": message_['conversation_message_id'],
            "from_id": message_['from_id'],
            "date": message.date,
            "text": prefix + ' ' + signal,
            "peer_id": message.peer_id
        },
        "object": {
            "chat": None,
            "from_id": message_['from_id'],
            "value": prefix + ' ' + signal,
            "conversation_message_id": message_['conversation_message_id']
        },
        "vkmessage": message_
    }

    await send_request(__model)