mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-14 05:57:18 +00:00
Make createChunkedMessage allowedMentions more customizable
This commit is contained in:
parent
5a8b308934
commit
ca2ac12c1e
2 changed files with 5 additions and 4 deletions
|
@ -112,14 +112,14 @@ export async function log(pluginData: GuildPluginData<LogsPluginType>, type: Log
|
|||
setTimeout(async () => {
|
||||
const batchedMessage = pluginData.state.batches.get(channel.id)!.join("\n");
|
||||
pluginData.state.batches.delete(channel.id);
|
||||
createChunkedMessage(channel, batchedMessage, cfg.allow_user_mentions).catch(noop);
|
||||
createChunkedMessage(channel, batchedMessage, { users: cfg.allow_user_mentions }).catch(noop);
|
||||
}, batchTime);
|
||||
}
|
||||
|
||||
pluginData.state.batches.get(channel.id)!.push(message);
|
||||
} else {
|
||||
// If we're not batching log messages, just send them immediately
|
||||
await createChunkedMessage(channel, message, cfg.allow_user_mentions).catch(noop);
|
||||
await createChunkedMessage(channel, message, { users: cfg.allow_user_mentions }).catch(noop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
AllowedMentions,
|
||||
Attachment,
|
||||
Client,
|
||||
Constants,
|
||||
|
@ -751,11 +752,11 @@ export function chunkMessageLines(str: string, maxChunkLength = 1990): string[]
|
|||
export async function createChunkedMessage(
|
||||
channel: TextableChannel,
|
||||
messageText: string,
|
||||
allowUserPings: boolean = true,
|
||||
allowedMentions?: AllowedMentions,
|
||||
) {
|
||||
const chunks = chunkMessageLines(messageText);
|
||||
for (const chunk of chunks) {
|
||||
await channel.createMessage({ content: chunk, allowedMentions: { users: allowUserPings } });
|
||||
await channel.createMessage({ content: chunk, allowedMentions });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue