Giter Site home page Giter Site logo

discatpy-archive / library Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 6.0 3.95 MB

A high level, asynchronous Discord API wrapper made completely from scratch.

License: MIT License

Python 100.00%
python python3 discord discord-bots discord-api asyncio aiohttp os-independent http python39

library's People

Contributors

emretech avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

library's Issues

Discord models

This issue will track the coverage of Discord API models.

If you would like to contribute and you want to know how models are defined, check out the pre-existing models in discatpy.models!

  • Audit Logs
    • Audit Log
    • Audit Log Entry
    • Audit Log Change
  • Auto Moderation
    • Auto Moderation Rule
    • Auto Moderation Action
  • Channel
    • Text Channel
    • Voice Channel
    • DM Channel
    • Stage Channel
    • Forum Channel
    • News Channel
    • Category
    • Thread
    • Message
    • Followed Channel
    • Reaction
    • Overwrite
    • Thread Metadata
    • Thread Member
    • Default Reaction
    • Forum Tag
    • Embed
    • Attachment
    • Allowed Mentions
  • Emoji
  • Guild
    • Guild
    • Unavailable Guild
    • Guild Preview
    • Guild Widget Settings
    • Guild Widget
    • Guild Member
    • Integration
    • Ban
    • Welcome Screen
  • Guild Scheduled Event
    • Guild Scheduled Event
    • Guild Scheduled Event User
  • Guild Template
  • Invite
    • Invite
    • Invite Metadata
    • Invite Stage Instance
  • Stage Instance
  • Sticker
    • Sticker
    • Sticker Item
    • Sticker Pack
  • User
    • User
  • Voice
    • Voice State
    • Voice Region
  • Webhook
  • Application Commands
    • Application Command
  • Message Components
    • Action Row
    • Button
    • String Select Menu
    • User Select Menu
    • Role Select Menu
    • Mentionable Select Menu
    • Channel Select Menu
    • Text Input
  • Receiving and Responding
    • Interaction
    • Interaction Message
  • Permissions
    • Guild Role

HTTP Interaction support

Unlike Gateway Interactions which just require connecting to the Gateway as usual and receiving the INTERACTION event, HTTP Interactions will require a little more work however.

Rewrite the Generate Endpoints script

Overview of the Feature Request
Rewrite the generate endpoints script, renaming it to generate_routes.py, rename the data/endpoints folder to data/routes, and change the type of the files used in data/routes from JSON to TOML.

What is this Feature Request for?
DisCatCore

The Problem
The generate endpoints script needs a good code scrub. There are some things that could be done better or just completely removed, like the function generator's generate method. Also the function generator's methods for managing arguments can be removed in favor of the publicly available list of args. There might be more, and they'll be seen in my PR.

Now to the name changes. Since the beginning of the endpoint generator, I thought that the name "endpoint" sounded more appropriate and did not consider the name "route" at all. The name "route" is used for the HTTP client to specify the metadata about a Discord API route. It makes more sense to name our endpoint generate a route generator since the route wrappers generated wrap Discord API routes (obviously).

Finally, the file change. JSON is unreadable for our purposes.. TOML would be a better format, since it's designed to be a config file format and human readable.

The Solution
Here's what a new route file under TOML will look like:

name = "UserRoutes"
requires = ["typing", "discord_typings"]

[get_current_user]
method = "GET"
url = "/users/@me"

[get_user]
method = "GET"
url.link = "/users/{user_id}"
url.parameters = [{name = "user_id", type = "dt.Snowflake"}]

[modify_current_user]
method = "PATCH"
url = "/users/@me"
json.parameters = [
    {name = "username", type = "UnsetOr[str]", default = "Unset"},
    {name = "avatar", type = "UnsetOr[t.Optional[str]]", default = "Unset"},
]

[get_current_user_guilds]
method = "GET"
url.link = "/users/@me/guilds"
url.parameters = [
    {name = "before", type = "UnsetOr[dt.Snowflake]", default = "Unset"},
    {name = "after", type = "UnsetOr[dt.Snowflake]", default = "Unset"},
    {name = "limit", type = "int", default = "200"},
]

Current Solution
N/A

Additional context
N/A

Pass init parameters into the underlying Gateway & HTTP clients

Currently, there is no way to pass init parameters that the Gateway & HTTP clients from DisCatCore support via discatpy.Bot. This is not a good thing because customization is an important thing to offer.

One solution I have in mind is to make a special data class that sort of acts like a wrapper for passing arguments into the Gateway & HTTP clients. Some important values like token or intents will be left out of these data classes because those are more important parameters than the rest of the parameters the Gateway & HTTP clients support.

Migrate to PDM

Overview of the Feature Request
Migrate DisCatCore & DisCatPy to PDM.

What is this Feature Request for?
DisCatCore & DisCatPy

The Problem
Poetry doesn't have a lot of tools & customization compared to PDM. PDM has built-in dynamic version management and build hooks that can make automation easier. Plus, although this doesn't technically matter, PDM supports PEP 621 style metadata, while Poetry doesn't.

The Solution
N/A

Current Solution
N/A

Additional context
discatpy-archive/core#34 was my implementation of this with DisCatCore. Some of the aspects, like the CI, can be migrated directly from this.

Major API Redesign

Currently, the DisCatPy API design is all over the place. It's just a glob of files into one big source folder. Instead, it would be more ideal if the major parts of the API are split into individual folders inside of this source folder.

In progress via the api-refactor branch.

Make a better logo

Overview of the Feature Request
Make a better logo for DisBotPy

What is this Feature Request for?
The repository

The Problem
The logo right now is too long for some portions of where the logo could be used. And it's also not the best logo and could be redesigned.

The Solution
Make a smaller logo, preferably one that is 512x512 for the Discord server.

Additional context
What should be done:

  • Recolor the logo to have "consistent" tones

`abs.py` -> `abc.py`

Describe the Bug
abs.py file contains abstract base classes and should be named abc.py. "abs" usually means "absolute" and will likely confuse future contributors.

Reproduction Steps
ls

Expected Behavior
A clear and meaningful name for file

Actual Behavior
File name which will likely cause misunderstandings

Traceback Error
N/A

System Information
N/A

Additional Context
N/A

Split the core and models/extensions into different repos

Pretty straightforward. Depends on #8.

The reason for doing this is that DisCatPy itself is a more higher level Discord API wrapper but it has a core API that's accessible to users. It would make more sense if they were split. DisCatCore would be the name of the lower level API and the higher level API would keep its current name, DisCatPy.

This will most likely be done when I make a separate organization for DisCatPy.

Bump Python version minimum to 3.9

Overview of the Feature Request
Bump the Python version minimum from 3.8 to 3.9.

What is this Feature Request for?
The whole library

The Problem
Currently, we are using type alias like Dict or List from the typing module. However, in PEP 585 these type alias were deprecated for their builtin counterparts. This PEP unfortunately was not implemented in Python 3.8 but 3.9.

The Solution
Bump the Python version minimum in setup.py (pyproject.toml for the API redesign) from 3.8 to 3.9.

Current Solution
Since it's only deprecated and not removed entirely in 3.9, keeping it wouldn't really affect anything. But if it is going to be removed soon, then it's better to be prepared now then later.

One solution I came up with to circumvent this is to redefine these type aliases to either be their builtin counterparts or to be the type alias from the typing module. However, this does seem unnecessary. Another solution is to use the new stringized annotations feature (from __future__ import annotations) in every module.

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.