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
Polars-fun - Example notebooks for how to use pola.rs

polars-fun Polars is an awesome Rust DataFrame library with Python language bindings. This repo makes it easy to run Polars code on your local machine

Matthew Powers 2 Jun 28, 2022
A Discord Bot coded using Python. Open to collaboration

DisPy-Bot A Discord Bot coded using Python. Open to collaboration La syntax pour intégrer le bot (imaginons la fonction lol_reponse dans le fichier au

BiMathAx 2 Mar 03, 2022
A command line interface for accessing google drive

Drive Cli Get the ability to access Google Drive without leaving your terminal. Inspiration Google Drive has become a vital part of our day to day lif

Chirag Shetty 538 Dec 12, 2022
ZELDA USERBOT adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy.

ZELDA USERBOT TELEGRAM Userbot Yang Di Buat Karena Sering Gabut Di Telegram. ZELDA USERBOT adalah userbot Telegram modular yang berjalan di Python3 de

1 Dec 23, 2021
The Official Twilio SendGrid Led, Community Driven Python API Library

The default branch name for this repository has been changed to main as of 07/27/2020. This library allows you to quickly and easily use the SendGrid

Twilio SendGrid 1.4k Jan 07, 2023
Bender: A Markov Babbler Slack Bot

See the Digital Ocean tutorial for instructions on how to get the basic bot structure in place. Once you have that, set the gunicorn command to run as

Andrew Howard 1 Dec 04, 2021
A Bot to Upload files to Many Cloud services. Powered by Telethon.

oVo MultiUpload V1.0 👀 A Bot to Upload files to Many Cloud services. Powered by Telethon _ 🎯 Follow me and star this repo for more telegram bots. @H

32 Dec 30, 2022
The best discord.py template with a changeable prefix

Discord.py Bot Template By noma4321#0035 With A Custom Prefix To Every Guild Function Features Has a custom prefix that is changeable for every guild

Noma4321 5 Nov 24, 2022
Python binding for Terraform.

Python libterraform Python binding for Terraform. Installation $ pip install libterraform NOTE Please install version 0.3.1 or above, which solves the

Prodesire 28 Dec 29, 2022
YuuScource - A Discord bot made with Pycord

Yuu A Discord bot made with Pycord Features Not much lol • Easy to use commands

kekda 9 Feb 17, 2022
Discord.py-Bot-Template - Discord Bot Template with Python 3.x

Discord Bot Template with Python 3.x This is a template for creating a custom Di

Keagan Landfried 3 Jul 17, 2022
A GUI Weather Application written with Python

weather-box - A GUI Weather Application written with Python Made with ❤️ by Suresh Mishra

Suresh Mishra 2 Dec 18, 2021
Bill is a bot capable to Chat with you, search everything on web to you, and send message to yours contacts for you.

Bill Bot The inteligent Bot Bill is a intelligent bot, it can chat, search and send messages to you. Chat with You Send messages on WhatsApp for you S

João Assalim 3 Sep 12, 2021
Finds Jobs on LinkedIn using web-scraping

Find Jobs on LinkedIn 📔 This program finds jobs by scraping on LinkedIn 👨‍💻 Relies on User Input. Accepts: Country, City, State 📑 Data about jobs

Matt 44 Dec 27, 2022
👨‍💼Linkedin API for Python

linkedin_api 👨‍💼 Linkedin API for Python No "official" API access required - just use a valid Linkedin account! Programmatically send messages, get

Tom Quirk 918 Dec 29, 2022
Web app for spotify playlist management with last.fm integration

Music Tools Set of utility tools for Spotify and Last.fm. Built on my other libraries for Spotify (spotframework), Last.fm (fmframework) and interfaci

andy 3 Dec 14, 2022
dex.guru python sdk

dexguru-sdk.py dexguru-sdk.py allows you to access dex.guru public methods from your async python scripts. Installation To install latest version, jus

DexGuru 17 Dec 06, 2022
WILSON Cloud Respwnder is a Web Interaction Logger Sending Out Notifications with the ability to serve custom content in order to appropriately respond to client-issued requests.

WILSON Cloud Respwnder What is this? WILSON Cloud Respwnder is a Web Interaction Logger Sending Out Notifications (WILSON) with the ability to serve c

48 Oct 31, 2022
A simple Python wrapper for the archive.is capturing service

archiveis A simple Python wrapper for the archive.is capturing service. Installation pipenv install archiveis Python Usage Import it. import archi

PastPages 157 Dec 28, 2022
Telegram bot for stream music or video on telegram

KYURA MUSIC Telegram bot for stream music or video on telegram, powered by PyTgCalls and Pyrogram Help Need Help me to translate this repo, click the

0 Dec 08, 2022