This application can connect to either a PostgreSQL or MySQL database. Configure the connection using the following environment variables:
DB_DRIVER: Specifies the database driver. Usepostgresfor PostgreSQL ormysqlfor MySQL. Defaults topostgres.DB_HOST: The hostname or IP address of your database server. (e.g.,localhostor an IP)DB_PORT: The port number for your database server. (e.g.,5432for PostgreSQL,3306for MySQL)DB_USER: The username for connecting to the database.DB_PASSWORD: The password for the database user.DB_NAME: The name of the database to connect to.DB_SSLMODE: (Optional) SSL mode for the database connection.- For PostgreSQL: e.g.,
require,prefer,allow,disable. Refer topgdocumentation for details. - For MySQL: Set to
trueorfalse(or provide SSL options object structure if needed, though current adapter uses basic boolean). Refer tomysql2documentation.
- For PostgreSQL: e.g.,
You can set these environment variables in a .env file in the root of the project. A dev.env.sample is provided as a template.
Connects the bot to the configured database based on the environment variables.
Usage: /connect
Replies with a success or failure message.
Checks for potentially broken invoices within a specified date range. This command requires an active database connection (use /connect first).
Usage: /check-broken-invoice start_date:YYYY-MM-DD end_date:YYYY-MM-DD
start_date: The start date for the period to check (format: YYYY-MM-DD).end_date: The end date for the period to check (format: YYYY-MM-DD).
The command will return:
- A list of 'UNPAID' invoices created within the date range that do not have any associated invoice items.
- A list of 'UNPAID' invoice items (for 'DROPOFF' or 'PICKUP' type invoices) created within the date range that do not have any associated shipment records.
Disconnects the bot from the current database if a connection is active.
Usage: /disconnect
Replies with a success message or an informational message if not connected.
Clears messages from the current channel. Requires "Manage Messages" permission.
Usage: /clear-chat <subcommand>
Subcommands:
-
all- Clears all messages in the current channel.
- Note: Messages older than 2 weeks are deleted individually, which can be slow and is subject to stricter rate limits. Discord API limits bulk deletion to messages newer than 2 weeks.
- Usage:
/clear-chat all
-
fixed- Clears a specific number of the most recent messages.
- Parameters:
number(Integer, Required): The number of messages to delete (1-1000).
- Usage:
/clear-chat fixed number:50
-
range- Clears messages within a specified date range.
- Parameters:
start_date(String, Required): The start date of the range. Accepts YYYY-MM-DD format (e.g., "2023-01-01") or relative terms like "1d" (1 day ago), "today".end_date(String, Optional): The end date of the range. Accepts YYYY-MM-DD format or relative terms. Defaults to the current time if not provided.
- Usage examples:
/clear-chat range start_date:2023-10-01 end_date:2023-10-05/clear-chat range start_date:2d(clears messages from 2 days ago until now)/clear-chat range start_date:2023-11-01(clears messages from 2023-11-01 until now)
- Chatbot AI
- Generate Image
- Make ur (Discord)[https://discord.com/] Server
- Create Developer Applications (Here)[https://discord.com/developers/applications]
- Authorize your app, choose bot and applied as administrator (here)[https://discord.com/developers/applications/<application_id>/oauth2/url-generator]
- Discover your bot token (here)[https://discord.com/developers/applications/<aplication_id>/bot], choose reset token to get a new one, save it for later
- Update dev.env value to your own
- Run NPM start