interactions.py icon indicating copy to clipboard operation
interactions.py copied to clipboard

feat: Add `__str__` to `Application`

Open CaedenPH opened this issue 3 years ago • 4 comments

About

This pull request is about (X), which does (Y).

Checklist

  • [x] I've ran pre-commit to format and lint the change(s) made.
  • [x] I've checked to make sure the change(s) work on 3.8.6 and higher.
  • [ ] This fixes/solves an Issue (If existent):.
    • resolves #
  • I've made this pull request for/as: (check all that apply)
    • [ ] Documentation
    • [ ] Breaking change
    • [x] New feature/enhancement
    • [ ] Bugfix

CaedenPH avatar Aug 02 '22 21:08 CaedenPH

Please make sure to track the unstable branch, currently it is the stable one.

mAxYoLo01 avatar Aug 02 '22 21:08 mAxYoLo01

This pull request is about (X), which does (Y).

Also please explain why you want this change since I don't know anything about the intentions of this PR/why the change should be implemented/...

Also, as already mentioned, please target the unstable branch for your pr

When printing client.me, a user is left with an unfriendly Application instance, this would mean that it prints the username.

CaedenPH avatar Aug 02 '22 21:08 CaedenPH

A better way to give more information about it would be to add a __repr__ to the class, or to the user field. Using __str__ to give information when printing data usually isn't the best way to do it

Catalyst4222 avatar Aug 02 '22 22:08 Catalyst4222

A better way to give more information about it would be to add a __repr__ to the class, or to the user field. Using __str__ to give information when printing data usually isn't the best way to do it

attr_utils.field has a repr param, if you set that to True it'll show up when you print it out. When I add id and name to the repr, it prints (in my case) as Application(id=Snowflake(835925027337273354), name='CataBot 2.0'), which is more descriptive without tricking the user into thinking it's a string

Catalyst4222 avatar Aug 03 '22 04:08 Catalyst4222

Closing in favour of #1026

EepyElvyra avatar Aug 20 '22 12:08 EepyElvyra