Discord
The Discord Tool facilitates communication with Discord channels by providing features that allow you to send or fetch messages.
Please note that the Discord Tool is designed as a supplementary tool for an
exisiting chatbot and does not actively listen for new messages. For effective
operation, the app requires explicit identification of the target user_id
,
channel_id
, and/or message_id
within your instructions.
Setup
Get Discord Access Token
Follow this guide to create a Discord chatbot and grab your access token: https://discordpy.readthedocs.io/en/stable/discord.html (opens in a new tab)
Authorization
npi auth discord --access-token <discord-access-token>
Usage
npi app discord "Get the last 10 messages from the channel with ID {{channel_id}}"
Supported Features
Direct Messaging
- Description: Engage in one-on-one conversations by sending direct messages to a user. A new direct message channel will be created if necessary.
- In-Context Parameters1:
- Recipient's user ID.
- Content of the message.
Examples
-
Send a Greeting Message to a User
npi app discord "Send a greeting message to XXX (user id: {{user_id}})."
-
Ask for User Confirmation and Await Their Reply
npi app discord "Send a direct message to XXX (user id: {{user_id}}) asking them to confirm next Monday's meeting, and wait for their reply."
Message Dispatch
- Description: Post messages to a specified Discord channel.
- In-Context Parameters:
- Target channel ID.
- Content of the message.
Examples
-
Broadcast a Message to a Specific Channel
npi app discord "Send a greeting message to the channel with ID {{channel_id}}."
Message Retrieval
- Description: Fetch historic messages from a specified Discord channel.
- In-Context Parameters:
- Channel ID where the messages are located.
- (Optional) Maximum number of messages to retrieve.
Examples
-
Fetch Messages from a Channel
npi app discord "Get the last 10 messages from the channel with ID {{channel_id}}."
Message Response
- Description: Reply to an existing message within a Discord channel.
- In-Context Parameters:
- The channel ID of the message to respond to.
- Description to identify the message for a reply. The app will search and match the message according to your input.
- (Optional, Inferred) Content of the reply message.
Examples
-
Reply to a Message in a Channel
npi app discord "Reply to the latest message in the channel with ID {{channel_id}}. You can write anything you like."
Footnotes
Footnotes
-
In-Context Parameters refer to the special information that you may specify in the instructions. Parameters marked as Inferred could be deduced from the context without needing explicit mention. ↩