ayubun / discord-ttl

A simple-to-selfhost Discord bot that deletes server messages older than a configurable TTL (time to live)
MIT License
34 stars 5 forks source link

format the database schema so that discord-ttl is not wholly server-dependent #34

Closed ayubun closed 2 months ago

ayubun commented 6 months ago

this is important for future-proofing, in the event discord ever begins to support bots in user DMs 👀 perhaps just naming the current ttl_settings table to server_ttl_settings or something

Pyker commented 6 months ago

you could probably keep the server-based table but use something like @me as the server id for dms, and the dm channel id as... well, the channel id. that should make everything work together just fine

ayubun commented 6 months ago

well, i could, but that requires the column to be a string, which is more error prone :c @Pyker perhaps what i could do is have an in-code enum to represent this, and just assign it a negative value

Pyker commented 6 months ago

maybe, but keep in mind the maximum integer in sqlite is 1196994967353184296 if signed, 18446744073709551615 if it's unsigned. that's 19 and 20 chars, respectfully, and current snowflake ids are already at 19 chars, so perhaps it would be best to store them as strings regardless. apparently snowflake ids will only reach 20 chars in 2070 or so, but still.

ayubun commented 6 months ago

hm, thats a good point :o

ayubun commented 2 months ago

this is being worked on in #38