A Telegram bot for personal utilities

Overview

Aqua

Aqua is a Telegram bot for personal utilities.

Installation

  1. Prerequisites: Install Poetry for managing dependencies and fork/clone the repository. All commands and files below will assume you are at the project's root directory.
  2. Create your Telegram bot by speaking to Botfather.
  3. Rename config/db.example.json and config/bot.example.json respectively to config/db.json and config/bot.json. Also, replace the data in those files with your actual data:
    • config/db.json is not currently used for anything, though that may change in the future.
    • In config/bot.json: The token is provided to you by the Botfather.
    • In config/bot.json: The user_chat_id is optional and you may delete it completely if you don't want Aqua to perform authorization checks, in which case she will answer to anyone who messages her. If you do want Aqua to only answer to you but you don't know your user_chat_id, perform the next steps and you will be instructed on how to find it out.
  4. Create a virtual environment and install dependencies by running $ python3 -m venv .venv and $ poetry install.
  5. Ensure you are using the local Python with $ poetry shell and then run $ aqua to start the bot.
  6. Coming back to step 3, if you don't yet know your user_chat_id, run Aqua as described in step 5 and send her a /start message, then check your terminal. You should see a message that begins like this: WARNING - Received a message from 'XYZ', but user_chat_id is None. XYZ is your user_chat_id.

As far as using Aqua, that's all there is to installation. If you are interested in modifying the source code, check extra development instructions in CONTRIBUTING.md file.

Available commands

All commands below can be abbreviated (e.g. you can use /lo instead of /lorem) as long as your abbreviation is not ambiguous.

  • /lorem: generates one paragraph of Lorem Ipsum text.
  • /remindme <time> <time_unit> <message>: reminds you about <message> after the given amount of time. Example: /remindme 10 minute Get pizza in the oven will remind you about the pizza in about 10 minutes.
  • /sort <list_of_elements>: sorts your list. If all the elements are numbers, they will be sorted numerically, else alphabetically. Example: /sort 5 2 1 or /sort myword1 second_word.
  • /start: sends a "welcome" message. This can be useful to check if you have set up everything correctly.

More commands will be added soon!

License

Copyright 2021 Guilherme-Vasconcelos

Aqua is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Aqua is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with Aqua. If not, see https://www.gnu.org/licenses/.

Comments
  • Remindme command

    Remindme command

    • [x] Jobs queue: verifies once a minute for tasks to be executed. Optionally, save the queue to a file to ensure bot can still execute tasks even if server fails for a while.
    • [x] Command: /remindme
    enhancement 
    opened by Guilherme-Vasconcelos 1
  • Bump ansi-regex from 4.1.0 to 4.1.1

    Bump ansi-regex from 4.1.0 to 4.1.1

    Bumps ansi-regex from 4.1.0 to 4.1.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump minimist from 1.2.5 to 1.2.6

    Bump minimist from 1.2.5 to 1.2.6

    Bumps minimist from 1.2.5 to 1.2.6.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add isort and black

    Add isort and black

    Describe your idea https://github.com/psf/black https://github.com/PyCQA/isort

    Also remember to add recommended vscode extensions

    Also remember to ensure black's config is compatible with flake8 (or remove flake8 completely), then adapt github action workflow accordingly

    https://code.visualstudio.com/docs/python/editing#_sort-imports

    enhancement 
    opened by Guilherme-Vasconcelos 0
  • Adapt GitHub Actions to use Poetry

    Adapt GitHub Actions to use Poetry

    Describe your idea Adapt GitHub Actions to use Poetry and then remove requirements.txt (also remove from CONTRIBUTING.md). Also merge bandit workflow to run in the same workflow as lint/test.

    enhancement 
    opened by Guilherme-Vasconcelos 0
  • /whatis command

    /whatis command

    Describe your idea Gives you the definition of a certain text.

    Extra information Maybe get the information from Wikipedia: https://foundation.wikimedia.org/wiki/Terms_of_Use/en https://www.mediawiki.org/wiki/API:Search https://www.mediawiki.org/wiki/API:Main_page https://www.mediawiki.org/wiki/Extension%3aTextExtracts#API

    enhancement high priority 
    opened by Guilherme-Vasconcelos 0
  • Add decorator to easily specify number of arguments

    Add decorator to easily specify number of arguments

    Describe your idea Instead of manually checking number of arguments in each function, add a decorator.

    @num_args(0)
    @authorize
    def start(...):
        ...
    

    Extra information There are some edge cases:

    • Some functions require any number of arguments
    • However, some functions can accept a variable number of arguments but require a minimum (such as remindme, which requires at least 3)
    • Suggestion:
      • Omitting @num_args means any number of arguments
      • @num_args(X) means exactly X arguments
      • @min_num_args(X) means at least X arguments
      • @max_num_args(X) means at most X arguments
    enhancement high priority 
    opened by Guilherme-Vasconcelos 0
  • Improve the pre-commit hook

    Improve the pre-commit hook

    Describe your idea The current pre-commit hook (located at hooks/pre-commit) is not completely reliable because it doesn't check for tricks such as:

    • Commented authorize;
    • authorize inside string

    For instance, these two snippets would be considered OK to the current pre-commit hook:

    # @authorize
    def start(...):
        ...
    
    '@authorize'
    def start(...):
        ...
    

    The task is to create a pre-commit hook that actually checks:

    • If all command handlers (i.e. files in aqua/extensions/commands) and the talk handler (aqua/extensions/talk/talk.py) are actually using a valid authorize (the authorize must be present, correctly placed and not inside a string or comment);
    • If all command handlers are described in the /help command: aqua/extensions/commands/help.py;

    Extra information

    • If the new pre-commit hook is not written in bash, remember to update the GitHub workflow accordingly (.github/workflows/pre-commit.yml).
    • Only the function that has the same name as the file needs an authorize (because that's the function which is executed by the bot). For example, the function def start(...) needs an authorize if it is located inside the start.py file.
    • Internal functions (those which begin with _ such as /_invalid, which is to be merged in command-abreviations branch) should not be documented in /help or README, though they must still have an authorize.
    • https://docs.python.org/3/library/ast.html + https://docs.pytest.org/en/6.2.x/ (possibility of writing tests and using AST to verify decorators. With this it is no longer required to have a pre-commit hook. These tests will act as some kind of static analysis.)
    enhancement high priority 
    opened by Guilherme-Vasconcelos 0
  • Possibility of using unambiguous abbreviations for commands

    Possibility of using unambiguous abbreviations for commands

    Describe your idea E.g. use the command /l instead of /lorem. If there are more commands that begin with l, the user should type at least the minimum required for it to be identified as a shortened version of lorem.

    Extra information Maybe a way to implement would be to create at startup time all the unambiguous abbreviations of all the methods, for instance: l, lo, lor, .... And the ambiguous abbreviations would all be a copy of some /_ambiguous_method command.

    enhancement 
    opened by Guilherme-Vasconcelos 0
  • Bump minimatch from 3.0.4 to 3.1.2

    Bump minimatch from 3.0.4 to 3.1.2

    Bumps minimatch from 3.0.4 to 3.1.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Create a client to talk to Aqua

    Create a client to talk to Aqua

    Describe your idea Currently Aqua requires you to log into Telegram, manually create your bot, manually set its token, etc.

    It would be cool to have a client that does all this automatically (to allow you to talk to Aqua more easily): you log into it, then it will create the bot and put it up running for as long as the client is running, and then open Aqua's chat. This way Aqua would actually become user friendly as the user would not need to modify its config and run it manually.

    Since the objective is to allow the user to talk to Aqua more easily, the client will only have Aqua's chat.

    Extra information The client could be a fork of https://github.com/telegramdesktop/tdesktop.

    Probably create it in a different repo.

    Before implementing this, read Telegram's client and API TOS to ensure this idea complies with everything.

    enhancement low priority 
    opened by Guilherme-Vasconcelos 0
  • When an ambiguous abbreviation is used, show available options

    When an ambiguous abbreviation is used, show available options

    Describe your idea Currently, when the user uses some ambiguous abbreviation (such as /s, which could be /start or /sort), Aqua will warn them about it being invalid but will not say the available options.

    enhancement low priority 
    opened by Guilherme-Vasconcelos 0
  • Add persistence to Job Queue

    Add persistence to Job Queue

    Describe your idea Job Queue is currently lost if Aqua turns off. While this isn't a problem for reminders that are only a few minutes after, it may be a problem for reminders scheduled to hours/days later.

    Extra information Suggestion: create a dump file once at the end of the JobQueue loop using pickle: https://docs.python.org/3/library/pickle.html

    Maybe use inspect.getsource: https://stackoverflow.com/questions/12072252/cant-get-source-code-for-a-method-declared-through-exec-using-inspect-in-pyth

    Alternatively, instead of each Job having a function to be executed, they could have a type instead (e.g. send_message type), which are easier to store / load.

    enhancement low priority 
    opened by Guilherme-Vasconcelos 0
  • Message notifications

    Message notifications

    Describe your idea Aqua needs a message notifications system to send messages to the user without necessarily them being an answer to something. This could be useful e.g. for some important news, custom alerts at specific times of the day, etc.

    Extra information

    1. Job Queue can probably be used to implement it (maybe create some permanent flag for each job. If the job is permanent, then it will always be re-enqueued. Then create some initializer to populate the job queue with the message notifications).
    2. Add a config/message_notifications.json file in which user will be able to pick the notifications they want to receive.
    enhancement medium priority 
    opened by Guilherme-Vasconcelos 0
Releases(v0.1.0)
Owner
Guilherme Vasconcelos
Guilherme Vasconcelos
Telegram Bot for saving and sharing personal and group notes

EZ Notes Bot (ezNotesBot) Telegram Bot for saving and sharing personal and group notes. Usage Personal notes: reply to any message in PM to save it as

Dash Eclipse 8 Nov 7, 2022
Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

Telegram VCVideoPlayBot An Telegram Bot By @ZauteKm To Stream Videos in Telegram Voice Chat. NOTE: Make sure you have started a VoiceChat in your Grou

Zaute 20 Oct 21, 2022
Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

SUBIN 449 Dec 27, 2022
This is telegram bot to generate string session for using user bots. You can see live bot in https://telegram.dog/string_session_Nsbot

TG String Session Generate Pyrogram String Session Using this bot. Demo Bot: Configs: API_HASH Get from Here. API_ID Get from Here. BOT_TOKEN Telegram

Anonymous 27 Oct 28, 2022
A telegram bot which can show you the status of telegram bot

BotStatus-Ts-Bot An open source telegram Bot Status bot For demo you can check here The status is updated in every 1 hour About Bot This is a Bot stat

Ts_Bots 8 Nov 17, 2022
Telegram PHub Bot using ARQ Api and Pyrogram. This Bot can Download and Send PHub HQ videos in Telegram using ARQ API.

Tg_PHub_Bot Telegram PHub Bot using ARQ Api and Pyrogram. This Bot can Download and Send PHub HQ videos in Telegram using ARQ API. OS Support All linu

TheProgrammerCat 13 Oct 21, 2022
veez music bot is a telegram music bot project, allow you to play music on voice chat group telegram.

?? Veez Music Bot Music bot for playing music on telegram voice chat group. Requirements ?? FFmpeg NodeJS nodesource.com Python 3.7+ PyTgCalls ?? Get

levina 143 Jun 19, 2022
A simple telegram voting bot based on the python-telegram-bot api.

A simple telegram voting bot based on the python-telegram-bot api. *To make it more easy to use, I might make a C++ code in the future so you don't ha

null 3 Sep 13, 2021
An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. This is Also The Source Code of The Bot Which is Being Used In @SafoTheBot Group! ❤️

Telegram Video Player Bot (Beta) An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. Special Features Supports Live Streaming From

SAF ONE 206 Jan 3, 2023
Telegram bot implementing Lex Arcana using python-telegram-bot library.

Lex Arcana Telegram Bot ?? Telegram bot implementing Lex Arcana using python-telegram-bot library. This bot was evaluated for the course "Computer Eng

Nicolò Sonnino 6 Jun 22, 2022
A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

Hash Minner 3 Nov 27, 2021
A Powerful telegram giveawayz bot based on the python-telegram-bot API

GiveawayZ Bot A Powerful telegram giveawayz bot based on the python-telegram-bot API. Powered by Team Zyntax and Team DFX Developed by @Zycho-Dev A pr

Zycho #AFK 5 Jul 31, 2022
Asad Alexa VC Bot Is A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group.

Asad Alexa VC Bot Is A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group.

Dr Asad Ali 6 Jun 20, 2022
A telegram bot script for generating session string using pyrogram and telethon on Telegram bot

String-session-Bot Telegram Bot to generate Pyrogram and Telethon String Session. A star ⭐ from you means a lot to us! Usage Deploy to Heroku Tap on a

Wahyusaputra 8 Oct 28, 2022
Video Bot: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Bot is an Advanced Telegram Bot that's allow you to play Video & Music on

null 5 Jan 26, 2022
Web-music-bot - A telegram bot which get a *site Url* and sends all songs contain in the Url to telegram

web music bot this is a telegram bot which get a site Url and sends all songs co

Arya Shabane 4 Apr 2, 2022
Telegram bot for logistic - Telegram bot for logistic

Демонстрационный телеграм-бот для нужд транспортной компании Цель проекта Реализ

M1chigun 1 Feb 5, 2022
A simple Telegram bot that analyses a given word, built with python-telegram-bot

Telegram Word Bot A simple Telegram bot that analyses a given word, built with python-telegram-bot. The bot is fairly useless - unless you often need

Chris N 2 Jul 14, 2022