Comparison of all the stuff I did. #6

Merged
Guzio merged 48 commits from fuckery into main 2026-03-02 15:17:09 +00:00
Showing only changes of commit ffed434c6a - Show all commits

View file

@ -314,16 +314,15 @@ const commands = [{
} }
catch (e_raw){ catch (e_raw){
const e = unmarshallDiscordError(e_raw) const e = unmarshallDiscordError(e_raw)
if (e.code === "NO_ATTACH_TARGET") { switch (e.code) {
return api.sendEvent(event.room_id, "m.room.message", { case "NO_ATTACH_TARGET": return api.sendEvent(event.room_id, "m.room.message", {
...ctx, ...ctx,
msgtype: "m.text", msgtype: "m.text",
"body": "⚠️ Couldn't find a Discord representation of the message under which you're trying to attach this thread (event ID `"+e_raw.was_supposed_to_be+"` on Matrix), so it wasn't created. Either you ran this command on an unbridged message (one sent by this bot or one that failed to bridge due to a previous error), or this is an error on our side and should be reported.", "body": "⚠️ Couldn't find a Discord representation of the message under which you're trying to attach this thread (event ID `"+e_raw.was_supposed_to_be+"` on Matrix), so it wasn't created. Either you ran this command on an unbridged message (one sent by this bot or one that failed to bridge due to a previous error), or this is an error on our side and should be reported.",
"format": "org.matrix.custom.html", "format": "org.matrix.custom.html",
"formatted_body": "⚠️ Couldn't find a Discord representation of the message under which you're trying to attach this thread (event ID <code>"+e_raw.was_supposed_to_be+"</code> on Matrix), so it wasn't created. Either you ran this command on an unbridged message (one sent by this bot or one that failed to bridge due to a previous error), or this is an error on our side and should be reported." "formatted_body": "⚠️ Couldn't find a Discord representation of the message under which you're trying to attach this thread (event ID <code>"+e_raw.was_supposed_to_be+"</code> on Matrix), so it wasn't created. Either you ran this command on an unbridged message (one sent by this bot or one that failed to bridge due to a previous error), or this is an error on our side and should be reported."
}) })
} case (160004): // see: https://docs.discord.com/developers/topics/opcodes-and-status-codes
else if (e.code === 160004) { // see: https://docs.discord.com/developers/topics/opcodes-and-status-codes
return api.sendEvent(event.room_id, "m.room.message", { return api.sendEvent(event.room_id, "m.room.message", {
...ctx, ...ctx,
msgtype: "m.text", msgtype: "m.text",
@ -331,22 +330,17 @@ const commands = [{
"format": "org.matrix.custom.html", "format": "org.matrix.custom.html",
"formatted_body": "There already exist a thread for the message you ran this command on (please run <code>/thread</code> (with no arguments and outside any threads) for details on attachment rules, if you're unsure what „ran this command on” refers to); cannot create a new one. Scroll up and see where the link could be.", "formatted_body": "There already exist a thread for the message you ran this command on (please run <code>/thread</code> (with no arguments and outside any threads) for details on attachment rules, if you're unsure what „ran this command on” refers to); cannot create a new one. Scroll up and see where the link could be.",
}) })
} case (50024): return api.sendEvent(event.room_id, "m.room.message", {
else if (e.code === 50024) {
return api.sendEvent(event.room_id, "m.room.message", {
...ctx, ...ctx,
msgtype: "m.text", msgtype: "m.text",
body: "You cannot create threads in a Discord channel of the type, to which this Matrix room is bridged to. Did you try to create a thread inside a thread?" body: "You cannot create threads in a Discord channel of the type, to which this Matrix room is bridged to. Did you try to create a thread inside a thread?"
}) })
} case (50035): return api.sendEvent(event.room_id, "m.room.message", {
else if (e.code === 50035) {
return api.sendEvent(event.room_id, "m.room.message", {
...ctx, ...ctx,
msgtype: "m.text", msgtype: "m.text",
body: "Specified thread name is too long - thread creation failed. Please yap a bit less in the title, the thread body is for that. ;)" body: "Specified thread name is too long - thread creation failed. Please yap a bit less in the title, the thread body is for that. ;)"
}) })
} default:
else {
await api.sendEvent(event.room_id, "m.room.message", { await api.sendEvent(event.room_id, "m.room.message", {
...ctx, ...ctx,
msgtype: "m.text", msgtype: "m.text",