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

(feat): add logout Command #414

Merged
merged 5 commits into from
May 31, 2024
Merged

(feat): add logout Command #414

merged 5 commits into from
May 31, 2024

Conversation

sudoskys
Copy link
Member

@sudoskys sudoskys commented May 31, 2024

/logout - clear credential

- Added logout command to clear user credentials.
- Handle logout command in private chat
- Add functionality to clear user credentials
- Update help message in the chat history clearing section
🔒 feat: add logout function for user logout functionality
Copy link
Contributor

coderabbitai bot commented May 31, 2024

Walkthrough

The changes primarily introduce a logout functionality across different messaging platforms (Discord, Kook, Slack, Telegram) within the application. This involves adding new commands to clear user credentials, enhancing user authentication and security. Various files were updated to incorporate the /logout command, ensuring consistent behavior across all platforms.

Changes

Files Change Summary
app/sender/discord/__init__.py Added listen_logout_command function to handle logout functionality.
app/sender/discord/event.py Updated /login command to set credential and introduced /logout command.
app/sender/kook/__init__.py Added logout function and listen_logout_command to handle logout functionality.
app/sender/kook/event.py Updated /login command to set credentials and introduced /logout command.
app/sender/slack/__init__.py Added listen_logout_command function to handle /logout command.
app/sender/slack/event.py Added /logout command in the help message.
app/sender/telegram/__init__.py Added listen_logout_command and updated listen_help_command for better formatting.
app/sender/telegram/event.py Updated command list structure and added /logout command.
app/sender/util_func.py Added logout function to handle user logout by updating credentials and sending success message.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant DiscordBot
    participant KookBot
    participant SlackBot
    participant TelegramBot
    participant AuthService

    User ->> DiscordBot: /logout
    DiscordBot ->> AuthService: clear credentials
    AuthService -->> DiscordBot: success
    DiscordBot -->> User: Logout success

    User ->> KookBot: /logout
    KookBot ->> AuthService: clear credentials
    AuthService -->> KookBot: success
    KookBot -->> User: Logout success

    User ->> SlackBot: /logout
    SlackBot ->> AuthService: clear credentials
    AuthService -->> SlackBot: success
    SlackBot -->> User: Logout success

    User ->> TelegramBot: /logout
    TelegramBot ->> AuthService: clear credentials
    AuthService -->> TelegramBot: success
    TelegramBot -->> User: Logout success
Loading

This sequence diagram illustrates the interaction between the user and the different bots (Discord, Kook, Slack, Telegram) when the /logout command is issued, showing the flow of clearing credentials and confirming the logout success.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 30e88c1 and d7966ea.

Files selected for processing (9)
  • app/sender/discord/init.py (2 hunks)
  • app/sender/discord/event.py (1 hunks)
  • app/sender/kook/init.py (2 hunks)
  • app/sender/kook/event.py (1 hunks)
  • app/sender/slack/init.py (2 hunks)
  • app/sender/slack/event.py (1 hunks)
  • app/sender/telegram/init.py (4 hunks)
  • app/sender/telegram/event.py (1 hunks)
  • app/sender/util_func.py (1 hunks)
Additional comments not posted (11)
app/sender/telegram/event.py (1)

24-24: The addition of the /logout command is correctly implemented and aligns with the PR's objectives to enhance user authentication functionality.

app/sender/discord/event.py (1)

19-20: The renaming of /login to set credential and the addition of the /logout command are correctly implemented and align with the PR's objectives to enhance user authentication functionality.

app/sender/kook/event.py (1)

38-39: The renaming of /login to set credential and the addition of the /logout command are correctly implemented and align with the PR's objectives to enhance user authentication functionality.

app/sender/slack/event.py (1)

27-27: The addition of the /logout command is correctly implemented and aligns with the PR's objectives to enhance user authentication functionality.

app/sender/util_func.py (1)

223-233: The implementation of the logout function is correctly done and aligns with the PR's objectives to enhance user authentication functionality by clearing user credentials.

app/sender/slack/__init__.py (1)

252-261: The implementation of the listen_logout_command function is correctly done and aligns with the PR's objectives to enhance user authentication functionality by handling the /logout command.

app/sender/kook/__init__.py (2)

37-37: The addition of the logout function to the import list is appropriate for enabling its use within this module.


335-342: The implementation of the listen_logout_command is correct and follows the async pattern expected for command handlers in this context. It properly uses the logout function and handles the message response appropriately.

app/sender/telegram/__init__.py (2)

255-264: The implementation of the listen_logout_command is correct and adheres to the async pattern. It properly parses the command, calls the logout function, and handles the message response correctly.


314-314: The update to use telegramify_markdown.convert in the listen_help_command is a good improvement for consistent message formatting.

app/sender/discord/__init__.py (1)

323-334: The implementation of the listen_logout_command in the Discord module is correct. It uses the logout function appropriately and responds to the user correctly.

@sudoskys sudoskys merged commit 63fc9b4 into main May 31, 2024
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.

1 participant