Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete bot rewrite, with interactions.py v5 #43

Closed
wants to merge 431 commits into from
Closed

Conversation

nattadasu
Copy link
Owner

@nattadasu nattadasu commented Apr 30, 2023

New Features

Added Integration

  • Added PronounDB integration for /profile discord
  • Introduce AniBrain for Manga, One-Shot, and Light Novel randomizer
  • Introduce IsItDownRightNow.com to check if sites is available to access or not
  • Introduce MyAnimeList native API for search lookup alternative
  • Introduce Random.org as true RNG
  • Introduce Shikimori for profile lookup
  • Introduce Spotify and Song.link for track information
  • Introduce The Color API for color information
  • Introduce Usrbg database to get user's custom background

For users

  • Added pronoun to Discord information
  • Added settings for user and guild scope
  • Allow user to check their AniList profile by invoking /profile anilist
  • Internationalization (i18n), and using Crowdin as translation portal Currently dropped until rewrite done, files were kept
  • Multiple /relations subcommands available to use
  • Randomize number, string, tv, shows, and manga
  • Track, album, and artist lookup
  • Utilities now available to use
  • Added commands:
    • /music album info
    • /music album search
    • /music artist info
    • /music artist search
    • /music track info
    • /music track search
    • /profile anilist
    • /profile discord
    • /profile shikimori
    • /random manga
    • /random movies
    • /random number
    • /random string
    • /random tv
    • /relations manga
    • /relations music album
    • /relations music track
    • /utilities avatar
    • /utilities banner
    • /utilities base64 — Encode or decode base64 string
    • /utilities color
    • /utilities math — Safely evaluate math expression supported by plusminus
    • /utilities qrcode
    • /utilities site status — Check if site is up or not

For developers

  • Added caching feature on nearly all 3rd party APIs supported by bot, saved as JSON file
  • Added proper testing by providing tests/ directory
  • All commands will be placed in an extension (eqv. as cog in discord.py) file
  • All interactions to 3rd Party API will be executed with classes instead
  • Better documentations for nearly all functions, immutable variables, classes, and enums
  • Better statically typed Python
  • Custom User Agent to tell if this bot... is actually a bot
  • Introduce dataclasses to every 3rd party API if possible for better typing
  • Jikan API wrapper now built in-house, rather confusingly relying on JikanPy and with their weird errors

Changes

  • All commands now will be shown as embed rather than plain text
  • /anime relations/relations shows, as SIMKL and Trakt are able to find other shows
  • /lastfm/profile lastfm
  • /profile/profile myanimelist, as /profile will be populated with similar showcase from several platforms
  • /random_nekomimi/random nekomimi, as well with subcommands:
    • boisboy
    • gurlgirl
    • true_randomrandomize
  • /snowflake/utilities snowflake
  • /whois/whoami, resolve privacy issue that might rise in the future. To show information about other users, use /profile discord instead

Fixed

  • Better profile showcase

  • Ping command should show web socket latency and other useful info rather spitting time.perf_counter() benchmark

    Note

    On current stable version, it has been patched temporarily to send embed based on rewrite version

  • Several weird bugs in ipy/4.3.4 bot ver, including:

    • incorrect timestamp on /snowflake
    • if user get NSFW anime on /anime random, it will spit random error
  • Security and performance fixes

  • Fix 200+ issues detected on Deepsource down to only under 10 issues excluding coverage, yay!

Removed

Currently untracked as rewrite hasn't been finished, yet

nattadasu and others added 30 commits April 23, 2023 02:13
Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>
* refactor: refactor useless `else` block in the loop

When a loop specifies no break statement, the else clause will always execute when the loop sequence is empty, thus making it useless.
It is recommended to have the statements under else in the same scope as the loop itself.
If the else clause does not always execute at the end of a loop clause, then the code should add a break statement within the loop block.

* Resolve unintended whitespaces on blank line

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Sultan Iskandar Maulana <nattadasu@nattadasu.my.id>
…`return` statement (#16)

The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `return` statement.
In the case of an `elif` after `return`, it can be written as a separate `if` block.
For `else` blocks after `return`, the statements can be shifted out of `else`. Please refer to the examples below for reference.

Refactoring the code this way can improve code-readability and make it easier to maintain.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
An object has been imported but is not used anywhere in the file.
It should either be used or the import should be removed.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Format code with autopep8 and isort

This commit fixes the style issues introduced in 7b2bb9c according to the output
from autopep8 and isort.

Details: https://app.deepsource.com/gh/nattadasu/ryuuRyuusei/transform/48839f57-c48c-4cbf-ac0f-80d7eb97da88/

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Sultan Iskandar Maulana <nattadasu@nattadasu.my.id>
Format code with autopep8 and isort

This commit fixes the style issues introduced in 520eb1e according to the output
from autopep8 and isort.

Details: https://app.deepsource.com/gh/nattadasu/ryuuRyuusei/transform/37af0f5f-d830-40bf-96ee-8f5ab22c50c8/

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Format code with autopep8 and isort

This commit fixes the style issues introduced in 584cd64 according to the output
from autopep8 and isort.

Details: https://app.deepsource.com/gh/nattadasu/ryuuRyuusei/transform/2a134225-94ca-4eb0-ae9c-534f618e88ac/

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
#22)

The method doesn't use its bound instance. Decorate this method with `@staticmethod` decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods [here](https://docs.python.org/3/library/functions.html#staticmethod).

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
* New translations en_US.yaml (Indonesian)

* New translations en_US.yaml (Malay)

* New translations en_US.yaml (Romanian)

* New translations en_US.yaml (French)

* New translations en_US.yaml (Spanish)

* New translations en_US.yaml (Afrikaans)

* New translations en_US.yaml (Arabic)

* New translations en_US.yaml (Catalan)

* New translations en_US.yaml (Czech)

* New translations en_US.yaml (Danish)

* New translations en_US.yaml (German)

* New translations en_US.yaml (Greek)

* New translations en_US.yaml (Finnish)

* New translations en_US.yaml (Hungarian)

* New translations en_US.yaml (Italian)

* New translations en_US.yaml (Japanese)

* New translations en_US.yaml (Korean)

* New translations en_US.yaml (Dutch)

* New translations en_US.yaml (Norwegian)

* New translations en_US.yaml (Polish)

* New translations en_US.yaml (Portuguese)

* New translations en_US.yaml (Russian)

* New translations en_US.yaml (Serbian (Cyrillic))

* New translations en_US.yaml (Swedish)

* New translations en_US.yaml (Turkish)

* New translations en_US.yaml (Ukrainian)

* New translations en_US.yaml (Chinese Simplified)

* New translations en_US.yaml (Chinese Traditional)

* New translations en_US.yaml (Vietnamese)

* New translations en_US.yaml (Portuguese, Brazilian)

* New translations en_US.yaml (Indonesian)

* New translations en_US.yaml (Hindi)

* New translations en_US.yaml (Malay)

* New translations en_US.yaml (Filipino)

* New translations en_US.yaml (Javanese)

* New translations en_US.yaml (LOLCAT)

* New translations en_US.yaml (Aceh)

* New translations en_US.yaml (Romanian)

* New translations en_US.yaml (French)

* New translations en_US.yaml (Spanish)

* New translations en_US.yaml (Afrikaans)

* New translations en_US.yaml (Arabic)

* New translations en_US.yaml (Catalan)

* New translations en_US.yaml (Czech)

* New translations en_US.yaml (Danish)

* New translations en_US.yaml (German)

* New translations en_US.yaml (Greek)

* New translations en_US.yaml (Finnish)

* New translations en_US.yaml (Hungarian)

* New translations en_US.yaml (Italian)

* New translations en_US.yaml (Japanese)

* New translations en_US.yaml (Korean)

* New translations en_US.yaml (Dutch)

* New translations en_US.yaml (Norwegian)

* New translations en_US.yaml (Polish)

* New translations en_US.yaml (Portuguese)

* New translations en_US.yaml (Russian)

* New translations en_US.yaml (Serbian (Cyrillic))

* New translations en_US.yaml (Swedish)

* New translations en_US.yaml (Turkish)

* New translations en_US.yaml (Ukrainian)

* New translations en_US.yaml (Chinese Simplified)

* New translations en_US.yaml (Chinese Traditional)

* New translations en_US.yaml (Vietnamese)

* New translations en_US.yaml (Portuguese, Brazilian)

* New translations en_US.yaml (Indonesian)

* New translations en_US.yaml (Hindi)

* New translations en_US.yaml (Malay)

* New translations en_US.yaml (Filipino)

* New translations en_US.yaml (Javanese)

* New translations en_US.yaml (LOLCAT)

* New translations en_US.yaml (Aceh)

* New translations en_US.yaml (Romanian)

* New translations en_US.yaml (French)

* New translations en_US.yaml (Spanish)

* New translations en_US.yaml (Afrikaans)

* New translations en_US.yaml (Arabic)

* New translations en_US.yaml (Catalan)

* New translations en_US.yaml (Czech)

* New translations en_US.yaml (Danish)

* New translations en_US.yaml (German)

* New translations en_US.yaml (Greek)

* New translations en_US.yaml (Finnish)

* New translations en_US.yaml (Hungarian)

* New translations en_US.yaml (Italian)

* New translations en_US.yaml (Japanese)

* New translations en_US.yaml (Korean)

* New translations en_US.yaml (Dutch)

* New translations en_US.yaml (Norwegian)

* New translations en_US.yaml (Polish)

* New translations en_US.yaml (Portuguese)

* New translations en_US.yaml (Russian)

* New translations en_US.yaml (Serbian (Cyrillic))

* New translations en_US.yaml (Swedish)

* New translations en_US.yaml (Turkish)

* New translations en_US.yaml (Ukrainian)

* New translations en_US.yaml (Chinese Simplified)

* New translations en_US.yaml (Chinese Traditional)

* New translations en_US.yaml (Vietnamese)

* New translations en_US.yaml (Portuguese, Brazilian)

* New translations en_US.yaml (Indonesian)

* New translations en_US.yaml (Hindi)

* New translations en_US.yaml (Malay)

* New translations en_US.yaml (Filipino)

* New translations en_US.yaml (Javanese)

* New translations en_US.yaml (LOLCAT)

* New translations en_US.yaml (Aceh)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
…atement (#27)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
The `pass` statement used here is not necessary. You can safely remove this.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
If a docstring fits in a single line (72 characters according to PEP8), it is
recommended to have the quotes on the same line.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
It is recommended to use `any` for this loop, as it will make your code smaller and more readable.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
…`break` statement (#35)

The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `break` statement.
In the case of an `elif` after `break`, it can be written as a separate `if` block.
For `else` blocks after `break`, the statements can be shifted out of `else`. Please refer to the examples below for reference.

Refactoring the code this way can improve code-readability and make it easier to maintain.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
@nattadasu nattadasu reopened this May 24, 2023
@nattadasu nattadasu marked this pull request as draft May 24, 2023 04:50
@nattadasu nattadasu marked this pull request as ready for review May 24, 2023 04:50
@nattadasu nattadasu marked this pull request as draft May 24, 2023 04:51
deepsource-autofix bot and others added 15 commits May 24, 2023 05:01
…`return` statement

The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `return` statement.
In the case of an `elif` after `return`, it can be written as a separate `if` block.
For `else` blocks after `return`, the statements can be shifted out of `else`. Please refer to the examples below for reference.

Refactoring the code this way can improve code-readability and make it easier to maintain.
An object has been imported but is not used anywhere in the file.
It should either be used or the import should be removed.
The method doesn't use its bound instance. Decorate this method with `@staticmethod` decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods [here](https://docs.python.org/3/library/functions.html#staticmethod).
Plus bug fixes on several related modules
Format code with autopep8 and isort

This commit fixes the style issues introduced in 75e9173 according to the output
from autopep8 and isort.

Details: https://app.deepsource.com/gh/nattadasu/ryuuRyuusei/transform/5de75024-4a0a-4ca7-8327-e520a52755c9/
"...Really" moment

Signed-off-by: Sultan Iskandar Maulana <nattadasu@nattadasu.my.id>
@codacy-production
Copy link

Coverage summary from Codacy

Merging #43 (f9aead0) into main (c8729ec) - See PR on Codacy

Coverage variation Diff coverage
Report missing for c8729ec1 84.39%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c8729ec) Report Missing Report Missing Report Missing
Head commit (f9aead0) 4154 3482 83.82%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#43) 4086 3448 84.39%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@nattadasu
Copy link
Owner Author

Eh, i think i'll make new PR as somehow the commit counts are extremely different

@nattadasu nattadasu closed this May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
1 participant