Skip to content

helpdm for participants#1629

Merged
ChrisLovering merged 22 commits into
python-discord:mainfrom
jacobmonck:jake/helpdm
Jun 12, 2021
Merged

helpdm for participants#1629
ChrisLovering merged 22 commits into
python-discord:mainfrom
jacobmonck:jake/helpdm

Conversation

@jacobmonck
Copy link
Copy Markdown
Contributor

closes #1567

This PR is for the help channel participant DMs, me and Griff went on and tested this in and we ran into no problems at all, we even went as far as testing it with multiple people.

This is the embed that the user receives in DMs.
image

Also added feedback if the user already has help DMs turned on already(this is the same for when the user turns them off)
image

@jacobmonck jacobmonck requested a review from vcokltfre June 7, 2021 21:01
@Xithrius Xithrius added a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: help channels Related to the help channel system p: 2 - normal Normal Priority t: feature New feature or request labels Jun 7, 2021
Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering left a comment

Choose a reason for hiding this comment

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

Just a few comments,. overall looks pretty good :D

Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
jacobmonck and others added 3 commits June 8, 2021 14:24
@jacobmonck
Copy link
Copy Markdown
Contributor Author

All requested changes have been done.

Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
Comment thread bot/exts/help_channels/_cog.py Outdated
@jacobmonck jacobmonck changed the title Jake/helpdm helpdm for participants Jun 9, 2021
Comment thread bot/exts/help_channels/_cog.py Outdated
Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering left a comment

Choose a reason for hiding this comment

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

Just one last change and the rest looks good. I've tested locally too and all seems well.

After the requested change is done, I'll merge in main and do a final test

Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering 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 and works for me locally 👍

@ChrisLovering ChrisLovering requested review from GDWR and ToxicKidz June 10, 2021 17:43
Copy link
Copy Markdown
Contributor

@GDWR GDWR left a comment

Choose a reason for hiding this comment

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

LGTM

@jacobmonck
Copy link
Copy Markdown
Contributor Author

@ToxicKidz thinking about it, I am not too sure about the 0, 1 to toggle the command.

@GDWR
Copy link
Copy Markdown
Contributor

GDWR commented Jun 11, 2021

@ToxicKidz thinking about it, I am not too sure about the 0, 1 to toggle the command.

If you was to add 0, 1 would you add true, false etc. etc.
The only other means of changing I would say is having the base command !helpdm toggle your current state

@ToxicKidz
Copy link
Copy Markdown
Contributor

ToxicKidz commented Jun 11, 2021

I was thinking of adding the bool converter which is pretty useful, it's still case insensitive and supports on and off.

@jacobmonck
Copy link
Copy Markdown
Contributor Author

What about just having !helpdm and that will toggle it?

@GDWR
Copy link
Copy Markdown
Contributor

GDWR commented Jun 11, 2021

I was thinking of adding the bool converter which is pretty useful, it's still case insensitive and supports on and off.

That is a really good suggestion, 👍

Comment on lines +543 to +551
@staticmethod
def _serialise_session_participants(participants: set[int]) -> str:
"""Convert a set to a comma separated string."""
return ','.join(str(p) for p in participants)

@staticmethod
def _deserialise_session_participants(s: str) -> set[int]:
"""Convert a comma separated string into a set."""
return set(int(user_id) for user_id in s.split(",") if user_id != "")
Copy link
Copy Markdown
Contributor

@MarkKoz MarkKoz Jun 12, 2021

Choose a reason for hiding this comment

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

Aren't sets in redis more appropriate for this sort of thing? It would remove the need to serialise and deserialise (unless you count str -> int as deserialisation). It wouldn't even need to retrieve all items since there are commands to check set membership.

Copy link
Copy Markdown
Contributor Author

@jacobmonck jacobmonck Jun 12, 2021

Choose a reason for hiding this comment

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

Async Rediscache doesn't support sets. We were thinking about using sets but when we figured out it doesn't support it, we switched to that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

aioredis does support it and async-redis cache can trivially be extended to support it (yes I think it's worth doing that).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note I'm not suggesting implementing the set operations with all the type conversion stuff. Just a basic SADD call or whatever that will store a string as given.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not too familiar with Redis can you please give more information about how I would implement this? Also I think it would be best to do this as a separate feature.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's alright. Let's just leave your implementation for now. I can try to merge set support into async-rediscache in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, sounds good!

@jacobmonck
Copy link
Copy Markdown
Contributor Author

jacobmonck commented Jun 12, 2021

Those weren't there before.... But as soon as I push they show up. No changes were made that would break anything.

Comment thread bot/exts/help_channels/_cog.py Outdated
Co-authored-by: ToxicKidz <78174417+ToxicKidz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: help channels Related to the help channel system p: 2 - normal Normal Priority t: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help Channel DM's For The Person Who Is Helping.

6 participants