Skip to content

Conversation

@zeffo
Copy link
Contributor

@zeffo zeffo commented Oct 7, 2021

Summary

This Pull Request adds support for Role Icons. This addresses #205.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, ...)

@Dorukyum
Copy link
Member

Dorukyum commented Oct 7, 2021

Aren't role icons already in work in #224 🤔

@izxxr
Copy link
Contributor

izxxr commented Oct 7, 2021

Aren't role icons already in work in #224 thinking

It needs improvements but I was and currently too busy so you can close 224 and merge this.

@izxxr
Copy link
Contributor

izxxr commented Oct 7, 2021

Also @zeffo, unicode_emoji can also be set as role icon and is sent by discord so add that too.

Also, add icon and unicode_emoji to Role.edit()

@Dorukyum
Copy link
Member

Dorukyum commented Oct 7, 2021

Yes, unicode_emoji is a data key on itself

@izxxr izxxr mentioned this pull request Oct 7, 2021
6 tasks
@zeffo
Copy link
Contributor Author

zeffo commented Oct 7, 2021

I didn't notice #224, my bad. Will make suggested changes, thank you both!

@Lulalaby
Copy link
Member

Lulalaby commented Oct 7, 2021

I didn't notice #224, my bad. Will make suggested changes, thank you both!

224 is closed now. Continue here

@zeffo
Copy link
Contributor Author

zeffo commented Oct 7, 2021

@nerdguyahmad do the docstrings look okay?

Copy link
Contributor

@izxxr izxxr left a comment

Choose a reason for hiding this comment

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

Looks good 🚀

@zeffo
Copy link
Contributor Author

zeffo commented Oct 7, 2021

isnt this exactly the same stuff which you did in your PR?

@izxxr
Copy link
Contributor

izxxr commented Oct 7, 2021

isnt this exactly the same stuff which you did in your PR?

I didn't do unicode emojis.

@zeffo
Copy link
Contributor Author

zeffo commented Oct 7, 2021

:| was just a few lines, you didnt have to close

@izxxr
Copy link
Contributor

izxxr commented Oct 7, 2021

:| was just a few lines, you didnt have to close

I was too busy. besides, Swas pointed out that my PR was pointing to the feature/slash instead of master and I had to create a followup PR to fix that but I couldn't get time to do that.

@Lulalaby
Copy link
Member

Lulalaby commented Oct 7, 2021

Pending check

Copy link
Member

@Lulalaby Lulalaby left a comment

Choose a reason for hiding this comment

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

Nothing works x~x

@zeffo
Copy link
Contributor Author

zeffo commented Oct 7, 2021

that should fix it

Copy link
Member

@Lulalaby Lulalaby left a comment

Choose a reason for hiding this comment

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

For now it's basically LGTM.

Add, Modify & Delete Icon/UnicodeEmoji is working.
However, I am afraid that we will have problems with deleting / removing the role icon when both was supplied.

We should probably set on a remove request both the icon and the unicode_emoji to None, to be sure that it'll get removed.

Implement a few logical checks.

Here is in example of DisCatSharp (C#)
Aiko-IT-Systems/DisCatSharp@459f12a

            if (emoji.HasValue && !iconb64.HasValue)
                pld.UnicodeEmoji = emoji;

            if (emoji.HasValue && iconb64.HasValue)
            {
                pld.IconBase64 = null;
                pld.UnicodeEmoji = emoji;
            }

            if (iconb64.HasValue)
                pld.IconBase64 = iconb64;

To be save look into our implementation commits: https://aitsys.dev/T31

Tested with https://aitsys.dev/F8400

@izxxr
Copy link
Contributor

izxxr commented Oct 8, 2021

For now it's basically LGTM.

Add, Modify & Delete Icon/UnicodeEmoji is working. However, I am afraid that we will have problems with deleting / removing the role icon when both was supplied.

We should probably set on a remove request both the icon and the unicode_emoji to None, to be sure that it'll get removed.

Implement a few logical checks.

Here is in example of DisCatSharp (C#) Aiko-IT-Systems/DisCatSharp@459f12a

            if (emoji.HasValue && !iconb64.HasValue)
                pld.UnicodeEmoji = emoji;

            if (emoji.HasValue && iconb64.HasValue)
            {
                pld.IconBase64 = null;
                pld.UnicodeEmoji = emoji;
            }

            if (iconb64.HasValue)
                pld.IconBase64 = iconb64;

To be save look into our implementation commits: https://aitsys.dev/T31

Tested with https://aitsys.dev/F8400

I might have got you wrong but what about:

if unicode_emoji is not MISSING and icon is not MISSING:
  raise TypeError("unicode_emoji and icon keyword arguments cannot be mixed")

@Lulalaby
Copy link
Member

Lulalaby commented Oct 8, 2021

I might have got you wrong but what about

True, well basically you can do it, but discord primary uses the icon then.
This restriction is up to the lib.

@zeffo
Copy link
Contributor Author

zeffo commented Oct 8, 2021

From what I'm understanding, icon needs to be None if unicode_emoji is passed by the user, correct?

@zeffo
Copy link
Contributor Author

zeffo commented Oct 8, 2021

I believe there are two ways we can go about this, one is to set icon to None if unicode_emoji is not MISSING, and the other way would be to check if unicode_emoji is not MISSING and icon is not None or MISSING and if so, raise an error. Which one sounds better?

@Lulalaby
Copy link
Member

Lulalaby commented Oct 8, 2021

I would prefer to automatically set the icon to None and note it in the docs as stated here: #254 (review)

Copy link
Member

@Lulalaby Lulalaby left a comment

Choose a reason for hiding this comment

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

LGTM

@CodeWithSwastik
Copy link
Contributor

LGTM 👍

@CodeWithSwastik CodeWithSwastik merged commit 26f422b into Pycord-Development:master Oct 8, 2021
BobDotCom added a commit to BobDotCom/pycord that referenced this pull request Oct 18, 2021
@BobDotCom BobDotCom mentioned this pull request Oct 18, 2021
6 tasks
CodeWithSwastik added a commit that referenced this pull request Oct 19, 2021
* Prefer static_format over format with static assets

* GitHub Action to lint Python code

* bytes, not Bytes

* Update lint_python.yml

* Delete lint_python.yml

* Fix typos discovered by codespell

* Fix typos discovered by codespell

* GitHub Action to run codespell

* Make id parameter positional only

* Code Of conduct is a suggestion by Github

* Change `ctx.send` to `ctx.respond` in the README (#197)

* Update README.rst

* Update README.rst

* Added START_EMBEDDED_ACTIVITIES permission #198 (#199)

* Use start_embedded_activities instead of create_instant_invite

* Use an Enum for embedded activites

* Fix error in docstring

* Add typehinting to pull request checklist

* fix: distribution

* change: display text

* fixup! Fix typo for overridden

* Changed unchanged change

* Add *items to View

* Add Pycord Development to LICENSE

* License updates

* Fix accidental deletion in 1257776

* Add dependabot

* Add CodeQL

* Bump sphinx from 4.0.2 to 4.2.0

Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 4.0.2 to 4.2.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/4.x/CHANGES)
- [Commits](sphinx-doc/sphinx@v4.0.2...v4.2.0)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Set pycord user-agent (#241)

* created delete_after parameter for ctx.respond (#180)

* created delete_after parameter for ctx.respond

* Update discord/interactions.py

Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>

* added eventloop thing

* fixed ensure_future

Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>

* Added `on_raw_typing` event (#63)

* Added `on_raw_typing` event

* Fixes and adjustments for on_raw_typing

Co-authored-by: Swas.py <61446939+CodeWithSwastik@users.noreply.github.com>

* add support for role icons (#254)

* add support for role icons

* add unicode_emoji attribute and change Role.edit

* role.edit required b64 string for icon

* passing None should remove the icon

* change documentation to reflect changes

* update docstring for Role

* invalid sentence

* remove unnecessary documentation

* add new valid keys

* add valid keys

* set icon to None if unicode_emoji is passed

* Fix typo in docs

* Use `ctx.respond` in favor of `ctx.send`

* Use `ctx.respond` in favor of `ctx.send`

* Added new embedded activites with documentation. (#267)

* Added new embedded activities

* Removed chess and renamed youtube2

* Documented `EmbeddedActivity` Enumeration

* renamed youtube_advance to watch_together and added dev version of it

Co-authored-by: Lala Sabathil <aiko@aitsys.dev>

* Updated docs with the new naming convention

Co-authored-by: Lala Sabathil <aiko@aitsys.dev>

Co-authored-by: Lala Sabathil <aiko@aitsys.dev>

* add support for sending file(s) in interaction response (#263)

* add support for sending file(s) in interaction response

* update docstring

* fix

* add ephemeral attribute to Attachment

* use dict.get to avoid KeyErrors (#268)

* Revert "Add a dunder len to Message (#176)" (#270)

This reverts commit 2858bd1.

* Add missing flags

* Fix typo

* Typos .-.

* Fix typo

Co-authored-by: Sonic4999 <sonictbm@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Izhar Ahmad <54180221+nerdguyahmad@users.noreply.github.com>
Co-authored-by: PGamerX <websitedesigner123456@gmail.com>
Co-authored-by: Gracie <87055757+Grace-codes@users.noreply.github.com>
Co-authored-by: Middledot <78228142+Middledot@users.noreply.github.com>
Co-authored-by: DeviousLab <deviouslab@gmail.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: Aomi Vel <69065737+AomiVel@users.noreply.github.com>
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
Co-authored-by: Dorukyum <doruk.ak@hotmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ian Webster <ianw_github@ianww.com>
Co-authored-by: Cheeseboy8020 <68305035+Cheeseboy8020@users.noreply.github.com>
Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>
Co-authored-by: Zeffo <43495198+zeffo@users.noreply.github.com>
Co-authored-by: Prince Raj <68418241+Prince2347X@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Co-authored-by: Lala Sabathil <aiko@aiko-it-systems.eu>
BobDotCom added a commit that referenced this pull request Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants