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
Code to help me strengthen my bot army

discord-bot-manager an api to help you manage your other bots auth lazy: using the browser dev tools, capture a post call and view the Authorization h

Riley Snyder 2 Mar 18, 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
A compatability shim between Discord.py and Hikari.

Usage as a partial shim: import discord import hikari import hikari_shim dpy_bot = discord.Client(intents=discord.Intents.all(), enable_debug_events=

EXPLOSION 3 Dec 25, 2021
tgEasy's Official Assistant Bot and Example Bot

tgEasy Assistant The assistant bot that helps people with tgEasy directly on Telegram. This repository contains the source code of @tgEasyRobot and th

Divide Projects™ 4 Dec 26, 2022
Telegram Group Management Bot based on phython !!!

How to setup/deploy. For easiest way to deploy this Bot click on the below button Mᴀᴅᴇ Bʏ Sᴜᴘᴘᴏʀᴛ Sᴏᴜʀᴄᴇ Find This Bot on Telegram A modular Telegram

Mukesh Solanki 5 Nov 17, 2021
Telegram Bot to store Posts and Documents and it can Access by Special Links.

Telegram Bot to store Posts and Documents and it can Access by Special Links. I Guess This Will Be Usefull For Many People..... 😇 . Features Fully cu

REX BOTZ 1 Dec 23, 2021
Telegram bot to host python bots

Host-Bot Setup the api Upload the flask api on your host #its not important to do #i used it just for simple captcha system + save ids on your host!

Plugin 15 Feb 11, 2022
Generate Heroku-like random names to use in your python applications

HaikunatorPY Generate Heroku-like random names to use in your python applications. Installation pip install haikunator Usage Haikunator is pretty sim

Atrox 116 Nov 15, 2022
A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API.

A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API. Amcrest and Dahua devices share similar firmwares. Dahua Cameras and NVRs also work with this module.

Marcelo Moreira de Mello 176 Dec 21, 2022
Discord bot to display private leaderboards for Advent of Code.

Advent Of Code Discord Bot Discord bot for displaying Advent of Code private leardboards, as well as custom leaderboards where participants can set th

The Future Gadgets Lab 6 Nov 29, 2022
Amanda-A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules.

Amanda-A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules.

Team Amanda 4 Oct 21, 2022
Python wrapper to simplify calls to AncestryDNA API.

AncestryDNA API wrapper Ancestry exposes an undocumented REST API for its DNA features. This Python wrapper inventories the available calls, and expos

Matt 2 Jun 10, 2022
A Telegram bot to upload files from Telegram or Direct links to Google Drive.

Google Drive Uploader Telegram Bot A Telegram bot to upload files from Telegram or Direct links to Google Drive. Features Telegram files support. Dire

IDNCoderX 21 Dec 05, 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
Python Wrapper for handling payment requests through the Daraja MPESA API

Python Daraja Description Python Wrapper for handling payment requests through the Daraja MPESA API Contribution Refer to the CONTRIBUTING GUIDE. Usag

William Otieno 18 Dec 14, 2022
An advanced telegram language translator bot

Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/FayasNoushad/Translator-Bot-V3/blob/main/LICE

Fayas Noushad 19 Dec 24, 2022
Programa de código abierto para probar el API de Bitso, el exchange más importante de América Latina.

Bitso Semiautomático Programa de código abierto para probar el API de Bitso, el exchange más importante de América Latina. Desarrollador Fernando Mire

Fernando Mireles 17 Dec 07, 2022
This tool is created by Shahzain and is one of the best self bots out there!

Shahzain SelfBot This tool is created by Shahzain and is one of the best self bots out there! Features Token Destroyer! Server Nuker(50-100 Bans Per S

Shahzain 6 Apr 02, 2022
Discord Mafia Game Bot using nextcord

Mafia-Bot Discord Mafia Game Bot using nextcord Features Mafia Game Game Replays Installation Run the following command to install required modules: p

Nian 6 Nov 19, 2022
Bot Auto Chess.com

Bot Auto Chess.com Is a suggestion for chess moves on the chess.com platform. The available features are: chess suggestions and moves automatically. i

Tn. Ninja 34 Jan 01, 2023