$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 or no) that determines whether to return the message's ID instead of its content. Defaults to no, 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.

Member04/23/2025
!!exec $latestMessage[$channelID]
Custom Command Bot 04/23/2025
Hello World

Example 2: Return the Latest Message ID

This example retrieves the ID of the most recent message from any user in the current channel.

Member04/23/2025
!!exec $latestMessage[$channelID;everyone;yes]
Custom Command Bot 04/23/2025
1234567890