Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove temporary spawn message to fix notifications #30

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

aldehir
Copy link
Collaborator

@aldehir aldehir commented Apr 5, 2024

The temporary !spawn_message <id> message prevents users from getting notifications when edited to include their handle. This removes that temporary message and posts the ready list.

A change to the send queue mechanism was required to include a callback, this way we can grab the message reference without relying on reading it from the on message event.

@aldehir aldehir requested a review from dcramps April 5, 2024 10:47
Copy link
Owner

@dcramps dcramps left a comment

Choose a reason for hiding this comment

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

lgtm

try:
await func(**kwargs)
result = await func(**kwargs)
Copy link
Owner

Choose a reason for hiding this comment

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

is **kwargs the pythonic way of doing variadics?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dcramps Yeah, kind of. When used as arguments to a function,*args and/or **kwargs, it'll unpack args for positional arguments and kwargs for the keyword arguments, respectively.

Variadics in python can be done like this.

def print_args(*args, **kwargs):
    print(args)
    print(kwargs)

>>> print_args(1, 2, 3, a=4, b=5)
(1, 2, 3)
{"a": 4, "b": 5}

As arguments,

def print_name(first, last, middle=None):
    return f"{first} {middle} {last}"

>>> name = ("john", "doe")
>>> opts = {"middle": "smith"}
>>> print_name(*name, **opts)
john smith doe

See iterable unpacking and dictionary unpacking.

@aldehir aldehir merged commit 641dab0 into dcramps:main Apr 5, 2024
@aldehir aldehir deleted the remove-spawn-message branch April 5, 2024 21:08
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.

2 participants