Example #1
0
async def save_note(client, message):
    if not DB_AVAIABLE:
        await message.edit("Your database is not avaiable!")
        return
    note_name, text, data_type, content, file_ref = get_note_type(message)

    if not note_name:
        await message.edit("```" + message.text +
                           '```\n\nError: You must give a name for this note!')
        return

    if data_type == Types.TEXT:
        file_id = None
        teks, button = parse_button(text)
        if not teks:
            await message.edit("```" + message.text +
                               '```\n\nError: There is no text in here!')
            return
    else:
        file_id = await client.forward_messages(
            Owner,
            message.chat.id,
            message.reply_to_message.message_id,
            as_copy=True)

    db.save_selfnote(message.from_user.id, note_name, text, data_type, content,
                     file_ref, file_id.message_id if file_id else None)
    await message.edit('Saved note `{}`!'.format(note_name))
Example #2
0
async def save_note(client, message):
	note_name, text, data_type, content = get_note_type(message)

	if not note_name:
		await message.edit("```" + message.text + '```\n\nError: You must give a name for this note!')
		return

	if data_type == Types.TEXT:
		teks, button = parse_button(text)
		if not teks:
			await message.edit("```" + message.text + '```\n\nError: There is no text in here!')
			return

	db.save_selfnote(message.from_user.id, note_name, text, data_type, content)
	await message.edit('Saved note `{}`!'.format(note_name))
Example #3
0
async def save_note(_client, message):
    if not DB_AVAILABLE:
        await message.edit("Your database is not avaiable!")
        return
    note_name, text, data_type, content = get_note_type(message)

    if not note_name:
        await message.edit("```" + message.text + '```\n\nError: You must give a name for this note!')
        return

    if data_type == Types.TEXT:
        teks, _ = parse_button(text)
        if not teks:
            await message.edit("```" + message.text + '```\n\nError: There is no text in here!')
            return

    db.save_selfnote(message.from_user.id, note_name, text, data_type, content)
    await message.edit(f'Saved note `{note_name}`!')