Dorukyum / Bond

A unique Discord bot for easy server organization and moderation
https://discord.gg/8JsMVhBP4W
GNU General Public License v3.0
41 stars 30 forks source link

Add pycord_examples #8

Closed ephemeral8997 closed 2 years ago

ephemeral8997 commented 2 years ago

The PycordManager object will have pycord_examples attribute which has all file names of pycord/examples, pycord/examples/app_commands and pycord_examples/views which can be used as choices for the p.example command.

ephemeral8997 commented 2 years ago

I changed the /example command to a subclass of SlashCommand so we can wrap the callback and add PycordManager.pycord_examples as choices of option. All these changes have been comitted to this pull request, the only remaining issue is filenames are limited to 25 choices per option, and this isn't enough for pycord/examples sadly

ephemeral8997 commented 2 years ago

I think we should use an embed to get the best results of the example found by regex.

ephemeral8997 commented 2 years ago

Since Discord has limited the choices to only 25 choices per option, embeds can contain more content.

Dorukyum commented 2 years ago

Good idea, maybe not regex but kinda like if search_string in example["name"]

ephemeral8997 commented 2 years ago

maybe the code should loop over the string and check if most letters match the example filename

ephemeral8997 commented 2 years ago

I think it's better than checking if the whole name is inside the example name, since typos might be in the search string

ephemeral8997 commented 2 years ago

I think It's ready for review

ephemeral8997 commented 2 years ago

It's finally ready for review, everything should be good now.

Dorukyum commented 2 years ago

Added in #32, it was a simpler approach. Thanks anyways.