nodebb-plugin-onekite-discord 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +6 -6
- package/package.json +1 -1
- package/plugin.json +3 -4
package/library.js
CHANGED
|
@@ -166,18 +166,18 @@ async function buildEmbed({ tid, pid, isReply }) {
|
|
|
166
166
|
const targetUrl = (isReply && pid) ? `${topicUrl}/${pid}` : topicUrl;
|
|
167
167
|
|
|
168
168
|
const baseTitle = decodeHtmlEntities((topicData.title || (isReply ? 'Nouvelle réponse' : 'Nouveau sujet')).toString());
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const safeTitle =
|
|
169
|
+
const titleWithCategory = categoryName ? `[${categoryName}] ${baseTitle}` : baseTitle;
|
|
170
|
+
const replyIcon = isReply ? '↪️ ' : '';
|
|
171
|
+
|
|
172
|
+
const safeTitle = titleWithCategory.slice(0, 256);
|
|
173
173
|
|
|
174
174
|
const excerpt = await getPostExcerpt(isReply ? pid : topicData.mainPid);
|
|
175
175
|
|
|
176
176
|
const postForUser = await posts.getPostFields(isReply ? pid : topicData.mainPid, ['uid']);
|
|
177
177
|
const username = await user.getUserField(postForUser.uid, 'username');
|
|
178
178
|
|
|
179
|
-
// Tout le titre dans l'embed : "[Catégorie] Titre
|
|
180
|
-
const embedTitle = `${safeTitle}
|
|
179
|
+
// Tout le titre dans l'embed : "↪️ [Catégorie] Titre – Pseudo" (pseudo sans lien)
|
|
180
|
+
const embedTitle = `${replyIcon}${safeTitle} – ${username}`.slice(0, 256);
|
|
181
181
|
|
|
182
182
|
// Embed title becomes clickable via embed.url
|
|
183
183
|
return { topicData, content: '', embed: { title: embedTitle, url: targetUrl, description: excerpt || '' } };
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "nodebb-plugin-onekite-discord",
|
|
3
3
|
"name": "Discord Onekite Notifier",
|
|
4
|
-
"description": "Notifie Discord via webhook pour nouveaux sujets et/ou
|
|
5
|
-
"library": "./library.js",
|
|
4
|
+
"description": "Notifie Discord via webhook pour nouveaux sujets et/ou réponses (NodeBB v4.x).",
|
|
6
5
|
"hooks": [
|
|
7
6
|
{
|
|
8
7
|
"hook": "static:app.load",
|
|
@@ -32,5 +31,5 @@
|
|
|
32
31
|
"acpScripts": [
|
|
33
32
|
"public/admin.js"
|
|
34
33
|
],
|
|
35
|
-
"version": "1.0.
|
|
36
|
-
}
|
|
34
|
+
"version": "1.0.6"
|
|
35
|
+
}
|