Message History (Expression) — DiSky

Addon: DiSky · Category: Expression · Since: 5.0.0-b1

Syntax

[the] last %number% [discord] messages (of|in|from) [the] [channel] %types.messagechannel%

Description

Fetches messages from the history of a channel. 'last X messages of a channel' returns the most recent ones, newest first. 'X messages before a message' returns the ones sent before it, closest (newest) first; 'X messages after a message' the ones sent after it, closest (oldest) first. The reference message itself is never included. Any amount works: above 100, the history is fetched page by page (one request per 100 messages). Fewer messages come back when the channel does not have that many. The amount must be at least 1. The bot needs the View Channel and Read Message History permissions. This asks Discord, so it needs 'await'.

Examples

await set {_msgs::*} to the last 10 messages of event-channel
send "newest: %discord content of {_msgs::1}%" to console
await purge (the last 50 messages in event-channel)
await set {_older::*} to the 20 messages before event-message
await set {_newer::*} to the 5 discord messages after {_pinned}

View source