Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Bea
4625544e34
chore: add global prettier ignore file
As prettier is not configured for this project, and the style doesn't
meet prettier's opinionated defaults, it's worth dropping this blanket
ignore until such a time (if ever) a prettier config is produced that
matches the styleguide of this project.
2026-03-26 12:16:32 +00:00
Bea
a01a325146
chore: editorconfig matching existing code format styles
An editor config has been written that matches existing indentation and
formatting used by this project, which should extend the courtesy of
intended tab use to other editors like NeoVim which are often conigured
to adhere to `.editorconfig` by default.

As part of this change, the official EditorConfig extension has been
added to VSCode recommendations, which should additionally enable
Code-like editors to additionally adhere to the rules of other files
like json and markdown which are the only types that deviate from
Cadence's global default.
2026-03-26 12:16:32 +00:00
Bea
c423590292
Look up thread IDs if channels cannot be found 2026-03-26 12:16:29 +00:00
4 changed files with 38 additions and 2 deletions

16
.editorconfig Normal file
View file

@ -0,0 +1,16 @@
root = true
[*]
indent_style = tab
tab_width = 3
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.json]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false

1
.prettierignore Normal file
View file

@ -0,0 +1 @@
*

5
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"recommendations": [
"editorconfig.editorconfig"
]
}

View file

@ -51,10 +51,24 @@ const preparedInsert = backfill.prepare("INSERT INTO backfill (channel_id, messa
async function event(event) {
if (event.t !== "GUILD_CREATE") return
const channel = event.d.channels.find(c => c.id === channelID)
if (!channel) return
let channel = event.d.channels.find(c => c.id === channelID) || (event.d.threads || []).find(c => c.id === channelID)
const guild_id = event.d.id
if (!channel) {
// May be an archived thread not present in GUILD_CREATE data - try fetching via API
try {
const fetched = await discord.snow.channel.getChannel(channelID)
if (!fetched.guild_id || fetched.guild_id !== guild_id) return
fetched.guild_id = guild_id
discord.channels.set(fetched.id, fetched)
channel = fetched
} catch (e) {
return
}
}
if (!channel) return
try {
await createRoom.syncRoom(channelID)
let last = backfill.prepare("SELECT cast(max(message_id) as TEXT) FROM backfill WHERE channel_id = ?").pluck().get(channelID) || "0"