Skip to content

Added ability to send DMs #27

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

botsarefuture
Copy link

Added ability to send DMs, if DM room does not exist, create new.

@@ -88,7 +90,16 @@ async def send_text_to_room(
logger.exception(f"Unable to send message response to {room_id}")
return f"Failed to send message: {ex}"


async def get_dm(client: AsyncClient, user: str):
room_id = self.store.get_dm(user_id=user)
Copy link
Member

Choose a reason for hiding this comment

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

self wont be defined here, and neither will be store. So you also need to pass in store to this function. Which may be tricky, as the send_text_to_room doesn't know about store either.

Possibly move this logic to Command._message (

async def _message(self):
), which has access to self.store, and then you can pass in the right room ID to send_text_to_room ? I think logically this is the right way to do it anyway, send_text_to_room is just a helper, _message is the method that processes the "message" command.

@jaywink
Copy link
Member

jaywink commented Sep 16, 2022

Additionally, we need to ensure that the room ID is removed from directs if the user leaves the room. Happy to help with that if you finish up the other things here.

@botsarefuture
Copy link
Author

Sorry, I accidentally clicked the button :)

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