From cd29a23936d7e111bb9255b9f411757e06ac7a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Sun, 14 Aug 2022 13:37:49 +0200 Subject: [PATCH] Update formatting --- CHANGELOG.md | 3 +- CONTRIBUTING.md | 24 ++++++------- README.md | 67 +++++++++++++++++++----------------- discord_reminder_bot/main.py | 64 +++++++++++++++++----------------- pyproject.toml | 7 ---- 5 files changed, 82 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f2020c..97f1509 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,4 +67,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `/remind resume` now has a list of all reminders instead of needing an ID. - `/remind remove` now has a list of all reminders instead of needing an ID. - `/remind list` now has a list of all reminders instead of needing an ID. -- !remind is now /remind. You need to reinvite the bot with the `applications.commands` scope for this to work. It will also take up to an hour for the slash command to be registered. +- !remind is now /remind. You need to reinvite the bot with the `applications.commands` scope for this to work. It will + also take up to an hour for the slash command to be registered. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe5c97e..e7be2ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,21 +1,21 @@ # How to contribute to discord-reminder-bot - [Star the project](https://github.com/TheLovinator1/discord-reminder-bot/stargazers) - - This is the easiest. Star the project and make me happy. + - This is the easiest. Star the project and make me happy. - [Report bugs](https://github.com/TheLovinator1/discord-reminder-bot/issues/new) - - Make sure that you are using the latest version. - - Collect all the information you can about the bug. - - What did you do? - - Error message and traceback (if any). - - Operating system, Platform, and Version. - - Python version, you can use `python --version` to get the version. - - Are you using Docker? + - Make sure that you are using the latest version. + - Collect all the information you can about the bug. + - What did you do? + - Error message and traceback (if any). + - Operating system, Platform, and Version. + - Python version, you can use `python --version` to get the version. + - Are you using Docker? - [Suggest enhancements](https://github.com/TheLovinator1/discord-reminder-bot/issues/new) - - Try to describe what you want to see added. - - I can't promise that I will add it, but I will try my best. + - Try to describe what you want to see added. + - I can't promise that I will add it, but I will try my best. - [Submit Pull Requests](https://github.com/TheLovinator1/discord-reminder-bot/pulls) - - The only demand I have is that the code works, it doesn't have to be perfect or efficient. - - And if it doesn't work, I will try to fix it :) + - The only demand I have is that the code works, it doesn't have to be perfect or efficient. + - And if it doesn't work, I will try to fix it :) ## Contact diff --git a/README.md b/README.md index 731144e..3c0e428 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Type `/remind` in a Discord server where this bot exists to get a list of slash ## Installation -You have two choices, [install directly on your computer](#Install-directly-on-your-computer) or using [Docker](https://hub.docker.com/r/thelovinator/discord-reminder-bot). +You have two choices, [install directly on your computer](#Install-directly-on-your-computer) or +using [Docker](https://hub.docker.com/r/thelovinator/discord-reminder-bot). ### Creating a Discord bot token @@ -22,34 +23,38 @@ You have two choices, [install directly on your computer](#Install-directly-on-y - You can change Icon and Username here. - Copy the bot token and paste it into the `BOT_TOKEN` environment variable. - Go to the OAuth2 page -> URL Generator - - Select the `bot` and `applications.commands` scope. - - Select the bot permissions that you want the bot to have. Select `Administrator`. (TODO: Add a list of permissions that are needed) - - Copy the generated URL and open it in your browser. You can now invite the bot to your server. + - Select the `bot` and `applications.commands` scope. + - Select the bot permissions that you want the bot to have. Select `Administrator`. (TODO: Add a list of permissions + that are needed) + - Copy the generated URL and open it in your browser. You can now invite the bot to your server. ### Install directly on your computer -- Install latest version of needed software: - - [Python](https://www.python.org/) - - You should use the latest version. - - You want to add Python to your PATH. - - [Poetry](https://python-poetry.org/docs/master/#installation) - - Windows: You have to add `%appdata%\Python\Scripts` to your PATH for Poetry to work. -- Download project from GitHub with git or download the [ZIP](https://github.com/TheLovinator1/discord-reminder-bot/archive/refs/heads/master.zip). - - If you want to update the bot, you can run `git pull` in the project folder or download the ZIP again. +- Install the latest version of needed software: + - [Python](https://www.python.org/) + - You should use the latest version. + - You want to add Python to your PATH. + - [Poetry](https://python-poetry.org/docs/master/#installation) + - Windows: You have to add `%appdata%\Python\Scripts` to your PATH for Poetry to work. +- Download project from GitHub with Git or download + the [ZIP](https://github.com/TheLovinator1/discord-reminder-bot/archive/refs/heads/master.zip). + - If you want to update the bot, you can run `git pull` in the project folder or download the ZIP again. - Rename .env.example to .env and open it in a text editor (e.g., VSCode, Notepad++, Notepad). - - If you can't see the file extension: - - Windows 10: Click the View Tab in File Explorer and click the box next to File name extensions. - - Windows 11: Click View -> Show -> File name extensions. + - If you can't see the file extension: + - Windows 10: Click the View Tab in File Explorer and click the box next to File name extensions. + - Windows 11: Click View -> Show -> File name extensions. - Open a terminal in the repository folder. - - Windows 10: Shift + right-click in the folder and select `Open PowerShell window here` - - Windows 11: Shift + right-click in the folder and Show more options and `Open PowerShell window here` + - Windows 10: Shift + right-click in the folder and select `Open PowerShell window here` + - Windows 11: Shift + right-click in the folder and Show more options + and `Open PowerShell window here` - Install requirements: - - Type `poetry install` into the PowerShell window. Make sure you are - in the repository folder with the [pyproject.toml](pyproject.toml) file. - - You may have to restart your terminal if it can't find the `poetry` command. Also double check that it's in your PATH. + - Type `poetry install` into the PowerShell window. Make sure you are + in the repository folder with the [pyproject.toml](pyproject.toml) file. + - You may have to restart your terminal if it can't find the `poetry` command. Also double check it is in + your PATH. - Start the bot: - - Type `poetry run bot` into the PowerShell window. - - You can stop the bot with Ctrl + c. + - Type `poetry run bot` into the PowerShell window. + - You can stop the bot with Ctrl + c. Note: You will need to run `poetry install` again if poetry.lock has been modified. @@ -60,22 +65,22 @@ Note: It can take up to one hour for the slash commands to be visible in the Dis Docker Hub: [thelovinator/discord-reminder-bot](https://hub.docker.com/r/thelovinator/discord-reminder-bot) - Rename .env.example to .env and open it in a text editor (e.g., VSCode, Notepad++, Notepad). - - If you can't see the file extension: - - Windows 10: Click the View Tab in File Explorer and click the box next to File name extensions. - - Windows 11: Click View -> Show -> File name extensions. + - If you can't see the file extension: + - Windows 10: Click the View Tab in File Explorer and click the box next to File name extensions. + - Windows 11: Click View -> Show -> File name extensions. - Open a terminal in the extras folder. - - Windows 10: Shift + right-click in the folder and select `Open PowerShell window here` - - Windows 11: Shift + right-click in the folder and Show more options and `Open PowerShell window here` + - Windows 10: Shift + right-click in the folder and select `Open PowerShell window here` + - Windows 11: Shift + right-click in the folder and Show more options + and `Open PowerShell window here` - Run the Docker Compose file: - - `docker-compose up` - - You can stop the bot with Ctrl + c. - - If you want to run the bot in the background, you can run `docker-compose up -d`. + - `docker-compose up` + - You can stop the bot with Ctrl + c. + - If you want to run the bot in the background, you can run `docker-compose up -d`. ## Help - Email: tlovinator@gmail.com - Discord: TheLovinator#9276 -- Steam: [steamcommunity.com/id/TheLovinator/](https://steamcommunity.com/id/TheLovinator/) - Send an issue: [discord-reminder-bot/issues](https://github.com/TheLovinator1/discord-reminder-bot/issues) - GitHub Discussions: [discord-reminder-bot/discussions](https://github.com/TheLovinator1/discord-reminder-bot/discussions) diff --git a/discord_reminder_bot/main.py b/discord_reminder_bot/main.py index 76f1616..064e168 100644 --- a/discord_reminder_bot/main.py +++ b/discord_reminder_bot/main.py @@ -59,7 +59,7 @@ def calc_countdown(job) -> str: # TODO: Explain this. return ", ".join( - f"{x} {y}{'s'*(x!=1)}" + f"{x} {y}{'s' * (x != 1)}" for x, y in ( (days, "day"), (hours, "hour"), @@ -466,10 +466,10 @@ async def remind_resume(ctx: SlashContext): ], ) async def remind_add( - ctx: SlashContext, - message_date: str, - message_reason: str, - different_channel: discord.TextChannel = None, + ctx: SlashContext, + message_date: str, + message_reason: str, + different_channel: discord.TextChannel = None, ): """Add a new reminder. You can add a date and message. @@ -605,21 +605,21 @@ async def remind_add( ], ) async def remind_cron( - ctx: SlashContext, - message_reason: str, - year: int = None, - month: int = None, - day: int = None, - week: int = None, - day_of_week: str = None, - hour: int = None, - minute: int = None, - second: int = None, - start_date: str = None, - end_date: str = None, - timezone: str = None, - jitter: int = None, - different_channel: discord.TextChannel = None, + ctx: SlashContext, + message_reason: str, + year: int = None, + month: int = None, + day: int = None, + week: int = None, + day_of_week: str = None, + hour: int = None, + minute: int = None, + second: int = None, + start_date: str = None, + end_date: str = None, + timezone: str = None, + jitter: int = None, + different_channel: discord.TextChannel = None, ): """Create new cron job. Works like UNIX cron. @@ -755,18 +755,18 @@ async def remind_cron( ], ) async def remind_interval( - ctx: SlashContext, - message_reason: str, - weeks: int = 0, - days: int = 0, - hours: int = 0, - minutes: int = 0, - seconds: int = 0, - start_date: str = None, - end_date: str = None, - timezone: str = None, - jitter: int = None, - different_channel: discord.TextChannel = None, + ctx: SlashContext, + message_reason: str, + weeks: int = 0, + days: int = 0, + hours: int = 0, + minutes: int = 0, + seconds: int = 0, + start_date: str = None, + end_date: str = None, + timezone: str = None, + jitter: int = None, + different_channel: discord.TextChannel = None, ): """Create new reminder that triggers based on a interval. diff --git a/pyproject.toml b/pyproject.toml index fccf092..82eae90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,10 +38,3 @@ types-pytz = "^2022.1.2" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" - -[tool.black] -line-length = 120 - -[tool.isort] -profile = "black" -line_length = 120