MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / sendNotification

Method sendNotification

packages/hydrooj/src/model/message.ts:68–75  ·  view source on GitHub ↗
(message: string, ...args: any[])

Source from the content-addressed store, hash-verified

66 }
67
68 static async sendNotification(message: string, ...args: any[]) {
69 const targets = await user.getMulti({ priv: { $bitsAllSet: PRIV.PRIV_VIEW_SYSTEM_NOTIFICATION } })
70 .project({ _id: 1, viewLang: 1 }).toArray();
71 return Promise.all(targets.map(({ _id, viewLang }) => {
72 const msg = app.i18n.translate(message, [viewLang || system.get('server.language')]).format(...args);
73 return MessageModel.send(1, _id, msg, MessageModel.FLAG_RICHTEXT);
74 }));
75 }
76}
77
78export async function apply() {

Callers 3

runFunction · 0.80
runFunction · 0.80
feedbackFunction · 0.80

Calls 5

getMultiMethod · 0.45
allMethod · 0.45
translateMethod · 0.45
getMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected