Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

✨ Guild & Channel properties for APIObjects #298

Merged
merged 37 commits into from
Dec 14, 2021

Conversation

Lunarmagpie
Copy link
Member

@Lunarmagpie Lunarmagpie commented Dec 8, 2021

This PR implements a way to get Guild, and Channels from APIObjects without fetching more info from the discord API. Using the GUILDS Intent, Guild and Channel info is cached to be used later.

object.guild -> Guild
object.channel -> Channel

Also made it so intents can be given as a iterable since I tried to do that before I knew you needed to add them 😢 Intents are also Intents.all() by default. This way new users will automatically have all features that require certain intents so it should be a little easier to use.

Middleware is the most important to review. Everything in the objects directory just has ChannelProprety or GuildProperty added to it and I think I changed the default value for position in the Channel object to 0 to make it easier to work with.

Check off the following

  • I have tested my changes with the current requirements
  • My Code follows the pep8 code style.

@Lunarmagpie Lunarmagpie marked this pull request as draft December 8, 2021 03:13
@codecov
Copy link

codecov bot commented Dec 8, 2021

Codecov Report

Merging #298 (954f6bf) into main (7602811) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #298   +/-   ##
=======================================
  Coverage   90.00%   90.00%           
=======================================
  Files           9        9           
  Lines         100      100           
=======================================
  Hits           90       90           
  Misses         10       10           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7602811...954f6bf. Read the comment docs.

@Lunarmagpie
Copy link
Member Author

I've switched to the boring solution where it has to be done manually 😔 Linters don't work well otherwise.

pincer/client.py Show resolved Hide resolved
pincer/client.py Outdated Show resolved Hide resolved
pincer/middleware/channel_create.py Show resolved Hide resolved
@Lunarmagpie
Copy link
Member Author

Theoretically all the logic should be implemented. Now I just need to add the properties 💀

@Lunarmagpie Lunarmagpie marked this pull request as ready for review December 11, 2021 21:45
Copy link
Member

@Sigmanificient Sigmanificient left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well i don't like the comma but i guess that come with black ¯\_(ツ)_/¯

pincer/middleware/channel_delete.py Outdated Show resolved Hide resolved
pincer/middleware/guild_role_delete.py Outdated Show resolved Hide resolved
pincer/middleware/interaction_create.py Outdated Show resolved Hide resolved
pincer/middleware/presence_update.py Outdated Show resolved Hide resolved
pincer/middleware/stage_instance_delete.py Outdated Show resolved Hide resolved
pincer/middleware/thread_delete.py Outdated Show resolved Hide resolved
pincer/middleware/thread_member_update.py Outdated Show resolved Hide resolved
pincer/middleware/webhooks_update.py Outdated Show resolved Hide resolved
pincer/utils/__init__.py Show resolved Hide resolved
@trag1c trag1c added the enhancement New feature or request label Dec 12, 2021
Lunarmagpie and others added 3 commits December 12, 2021 17:38
Co-authored-by: trag1c <77130613+trag1c@users.noreply.github.com>
Co-authored-by: trag1c <77130613+trag1c@users.noreply.github.com>
docs/interactions.rst Outdated Show resolved Hide resolved
pincer/middleware/thread_member_update.py Outdated Show resolved Hide resolved
@Lunarmagpie Lunarmagpie merged commit 399b2b8 into Pincer-org:main Dec 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants