Skip to content

Latest commit

 

History

History
312 lines (256 loc) · 6.22 KB

USAGE.md

File metadata and controls

312 lines (256 loc) · 6.22 KB

Here’s an improved, detailed, and structured version of your CLI documentation for the chat application, with code examples for better clarity:

Command Line Interface Documentation

Welcome to the chat application! This documentation will guide you through the various CLI commands available to interact with the platform. Commands are categorized for ease of use.


Table of Contents

  1. User Management
    • Register
    • Login
    • Logout
    • Update Username
    • Update Password
    • Delete User
  2. User Interaction
    • Search Users
    • Send Direct Messages
    • View Direct Messages
  3. Server Management
    • Create Server
    • Join Server
    • Leave Server
    • Invite Members
    • Manage Categories and Channels
    • Role Management
  4. Messaging
    • Send Messages
    • Display Messages

User Management

Register

Create a new user with the register command.
Command:

register --username <username> --password <password>

Example:

register --username alice123 --password secretpass

Login

Log in with your username and password.
Command:

login --username <username> --password <password>

**Example:**  
```bash
login --username alice123 --password secretpass

Logout

Log out of your current session.
Command:

logout

Example:

logout

Update Username

Change your username.
Command:

update-username <new_username> <current_password>

Example:

update-username alice_updated secretpass

Update Password

Change your password.
Command:

update-password <new_password> <current_password>

Example:

update-password newsecretpass secretpass

Delete User

Permanently delete your account and all associated data.
Command:

delete-user

Example:

delete-user

User Interaction

Search Users

Find other users on the platform. Returns up to 5 results.
Command:

search-users <search_term>

Example:

search-users alice

Send Direct Messages

Send a private message to another user.
Command:

send-dm <user_name>

Example:

send-dm bob123

You will be prompted to type your message after running the command.


View Direct Messages

View received direct messages.
Command:

display-dms

View Sent Direct Messages

View messages you have sent.
Command:

display-sent-dms

Server Management

Create a Server

Set up a new server.
Command:

create-server --name <server_name> --permission <join_permission>

Example:

create-server --name myServer --permission closed

join_permission can be open (anyone can join) or closed (invite only). Default is open.

Kickout users from server

Use kickout-member --server <server_name> --member <user_name> to kickout a member from a server. Note that you must be an owner or moderator for this. Use kickout-member server_name user_name to kickout a member from a server. Note that you must be an owner/moderator for this.

Create a invite code for server

Use create-invite-code server_name to create an invite code for a server. Note that you must be an owner/moderator for this.

Join a servre with code

Use join-server-with-code invite_code to join a server with an invite code.

Direct Messages and User Management


Join a Server

Join an existing server.
Command:

join-server --server <server_name>

Example:

join-server --server myServer

Leave a Server

Leave a server you are part of.
Command:

leave-server --server <server_name>

Example:

leave-server --server myServer

If you are the server owner, transfer ownership first.


Add Members to a Server

Invite users to your server (owner only).
Command:

add-member --server <server_name> --member <user_name>

Example:

add-member --server myServer --member charlie123

Create Categories and Channels

  • Add a Category:

    add-category --server <server_name> --category <category_name>

    Example:

    add-category --server myServer --category general
  • Add a Channel:

    add-channel --server <server_name> --channel <channel_name> --permissions <channel_perms> --type <channel_type> --category <parent_category>

    Example:

    add-channel --server myServer --channel text-chat --permissions member --type text --category general

Manage Roles

  • Create a Role:

    create-role --server <server_name> --role <role_name> --permission <role_permission>

    Example:

    create-role --server myServer --role moderator --permission moderator
  • Assign a Role:

    assign-role --server <server_name> --role <role_name> --member <member_name>

    Example:

    assign-role --server myServer --role moderator --member charlie123

Messaging

Send a Message

Send a message in a text channel.
Command:

send-msg --server <server_name> --channel <channel_name>

Example:

send-msg --server myServer --channel text-chat

You will be prompted to type your message after running the command.


Display Messages

View all messages in a channel.
Command:

display-messages --server <server_name> --channel <channel_name>

Example:

display-messages --server myServer --channel text-chat

Sending Direct Messages

Use send-dm --recipient username --message "your message" to send a direct message to a user.

Viewing Messages

Use display-dms with the --filter flag to view your messages:

  • display-dms --filter received to see received messages
  • display-dms --filter sent to see sent messages
  • display-dms --filter all or just display-dms to see all messages

User Management

Use delete-user --confirm yes to delete your user account permanently.

Note: You must be logged in to use these commands.