$latestMessage
Retrieves the most recent message content or ID from a channel, utilizing the cache for efficiency.
Usage
$latestMessage[Channel ID (defaults to current channel);User ID (defaults to all users);Return Message ID instead (yes/no, defaults to no)]
Explanation:
- Channel ID: The ID of the channel to search within. If omitted, it defaults to the channel where the command is executed (
$channelID
). - User ID: The ID of a specific user to filter messages by. If omitted, it includes messages from all users (
everyone
). - Return Message ID: A boolean value (
yes
orno
) that determines whether to return the message's ID instead of its content. Defaults tono
, returning the message content.
Examples
Example 1: Return the Latest Message Content
This example retrieves the content of the most recent message in the current channel.
Example 2: Return the Latest Message ID
This example retrieves the ID of the most recent message from any user in the current channel.