feat(cmd): add 10grans ez-tip && fix(cmd): media attachment && style(cmd): default format: markdown
This commit is contained in:
parent
831179b337
commit
56ce1ccd5e
9 changed files with 44 additions and 11 deletions
|
@ -16,8 +16,11 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
|||
'',
|
||||
`<b><a href="${registrar.config.fediverse}/notice/${events.data[0].id}">${events.data[0].account.acct}</a>
|
||||
<blockquote><i>${events.data[0].content}<br>
|
||||
${events.data[0].media_attachments.map(media =>
|
||||
`<a href="${media.remote_url}">`+`${media.description}`+'</a>'
|
||||
).join('<br>')}
|
||||
(id: ${events.data[0].id}</a>)
|
||||
</blockquote><br>`);
|
||||
</blockquote>`);
|
||||
} else {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
|
@ -26,8 +29,11 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
|||
<font color="#7886D7">has <a href="${registrar.config.fediverse}/notice/${events.data[0].id}">repeated</a>:
|
||||
<blockquote><a href="${events.data[0].reblog.account.url}">${events.data[0].reblog.account.acct}</a></blockquote>
|
||||
<blockquote>${events.data[0].content}<br>
|
||||
(id: ${events.data[0].id})
|
||||
</blockquote><br>`);
|
||||
${events.data[0].media_attachments.map(media =>
|
||||
`<a href="${media.remote_url}">`+`Proxied image, no description available.`+'</a>'
|
||||
).join('<br>')}
|
||||
<br>(id: ${events.data[0].id})
|
||||
</blockquote>`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
|||
'',
|
||||
`<hr><b><a href="${registrar.config.fediverse}/${notifications.data[0].account.id}">
|
||||
${notifications.data[0].account.acct}</a></b>
|
||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">favorited</a>
|
||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">favorited</a>
|
||||
your post:</b></font>
|
||||
<br><i><b>${notifications.data[0].status.content}</i></b><hr>`);
|
||||
} else if (notifications.data[0].type === 'mention') {
|
||||
|
@ -32,16 +32,16 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
|||
'',
|
||||
`<hr><b><a href="${registrar.config.fediverse}/${notifications.data[0].account.id}">
|
||||
${notifications.data[0].account.acct}</a></b>
|
||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">mentioned</a>
|
||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">mentioned</a>
|
||||
you:</b></font><br>
|
||||
<i><b>${notifications.data[0].status.content}</i></b>
|
||||
<br>[id: ${notifications.data[0].status.id}]</i></b><hr>`);
|
||||
<br>(id: ${notifications.data[0].status.id})</i></b><hr>`);
|
||||
} else if (notifications.data[0].type === 'reblog') {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
`<hr><b><a href="${registrar.config.fediverse}/${notifications.data[0].account.id}">
|
||||
${notifications.data[0].account.acct}</a></b>
|
||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">repeated</a>
|
||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">repeated</a>
|
||||
your post:</b></font><br>
|
||||
<i><b>${notifications.data[0].status.content}</i></b><hr>`);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ exports.runQuery = function (matrixClient, room, userInput, registrar) {
|
|||
method: 'POST',
|
||||
url: `${registrar.config.fediverse}/api/v1/statuses`,
|
||||
headers: { Authorization: `Bearer ${registrar.config.fediverseToken}` },
|
||||
data: { status: userInput },
|
||||
data: { status: userInput, content_type: `text/markdown` },
|
||||
}).then((response) => {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
|
|
|
@ -5,7 +5,7 @@ exports.runQuery = function (matrixClient, room, address, flaggedInput, registra
|
|||
method: 'POST',
|
||||
url: `${registrar.config.fediverse}/api/v1/statuses`,
|
||||
headers: { Authorization: `Bearer ${registrar.config.fediverseToken}` },
|
||||
data: { status: flaggedInput, in_reply_to_id: address },
|
||||
data: { status: flaggedInput, in_reply_to_id: address, content_type: `text/markdown` },
|
||||
}).then((response) => {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
|
|
21
commands/tip.js
Normal file
21
commands/tip.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const axios = require('axios');
|
||||
|
||||
exports.runQuery = function (matrixClient, room, address, flaggedInput, registrar) {
|
||||
axios({
|
||||
method: 'POST',
|
||||
url: `${registrar.config.fediverse}/api/v1/statuses`,
|
||||
headers: { Authorization: `Bearer ${registrar.config.fediverseToken}` },
|
||||
data: { status: `@10grans@fedi.cc tip `+ flaggedInput + ` to `+address },
|
||||
}).then((response) => {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'',
|
||||
`<b>
|
||||
<blockquote><i>Tipping ${response.data.content}<br>
|
||||
(id: ${response.data.id}</a>)
|
||||
</blockquote><br>`);
|
||||
})
|
||||
.catch((e) => {
|
||||
matrixClient.sendHtmlNotice(room.roomId,
|
||||
'', `${e}`);
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue