mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
feat: add plugins settings i18n + typing
This commit is contained in:
@@ -116,4 +116,23 @@ export class MessageService extends BaseService<
|
||||
limit,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the latest messages for a given subscriber
|
||||
*
|
||||
* @param subscriber - The subscriber whose message history is being retrieved.
|
||||
* @param limit - The maximum number of messages to return (defaults to 5).
|
||||
*
|
||||
* @returns The message history since the specified date.
|
||||
*/
|
||||
async findLastMessages(subscriber: Subscriber, limit: number = 5) {
|
||||
const lastMessages = await this.findPage(
|
||||
{
|
||||
$or: [{ sender: subscriber.id }, { recipient: subscriber.id }],
|
||||
},
|
||||
{ sort: ['createdAt', 'desc'], skip: 0, limit },
|
||||
);
|
||||
|
||||
return lastMessages.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user