#channel.default_auto_archive_duration funkiness

1 messages · Page 1 of 1 (latest)

regal blade
#

My bot creates threads in a specific channel that has "hide after inactivity" of 3 days. Someone complained that the threads were disappearing after only one day of inactivity.

I looked at the channel.default_auto_archive_duration for that specific channel and it says 1 day. Is there some other place I need to be looking to get the configured 3 days for the channel?

hidden moatBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

frozen tulip
#

I think you can set that value when creating the thread no?

regal blade
#

yes, but I'd really like to be able to see what the server admins have set the value to, rather than hard-coding it.

frozen tulip
#

I think you can get it using channel.default_auto_archive_duration

regal blade
#

that's what I'm saying. if you pull up edit channel in a discord client, it shows a duration of 3 days, but the channel.default_auto_archive_duration is 1 day.

frail gorge
#

that sounds like the discord client being messed up

frozen tulip
frail gorge
#

well, no, i dont think thats what theyre talking about

#

they explicitly said channel.default_auto_archive_duration is one day

frozen tulip
#

oooh

#

and the "channel" in that case is the actual channel or the thread?

regal blade
#

no, actually Max has it. Why doesn't the create_*_thread functions use what the channel has been configured for, in terms of "hide after inactivity"?

#

I'm all sorts of confused, and don't know if this is by design, or not.

frail gorge
#

presumably because theres no easy way of doing that with defaults

#

which begs the question of "why wasnt MISSING used" granted

#

unfortunately, to fix it would be breaking

#

so you'll just have to pass in the default archive date yourself (until v6 comes out)

regal blade
#

yeah, once I saw that the threads were defaulting to one day, I began digging into what was visible in the channel, and couldn't find anything other than that default_auto_archive_duration.

frozen tulip
#

yep should have been a case of MISSING default, retrieve the set value or the one the user provides

regal blade
#

ok, so I'm not going crazy... just need to hard-code the duration

frail gorge
#

point is - someone fucked up, and fixing the mistake isnt possible right now without breaking peoples code

#

so yeah, just need to hard code it in

regal blade
#

no worries, at least I can put my mind at ease and put this issue to rest 😉

frozen tulip
#

did you try something like: channel.create_thread(xxx, auto_archive_duration=channel.default_auto_archive_duration)

regal blade
#

no, I was just calling create_thread with just a title. I'm sure if I used channel.default_auto_archive_duration that it'd still set it to one day, since that's the value I'm printing as a debug step

#

I wonder if I go back up the chain into guild then back down to channels if the value is different

frail gorge
#

well thats frightening

frozen tulip
#

uh that's weird

frail gorge
#

im pretty sure those values are directly from the api 😅

regal blade
#

yeah, this is what I'm seeing:


dir(ctx.channel.default_auto_archive_duration)= ['__class__', '__doc__', '__module__', 'as_integer_ratio', 'bit_count', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'name', 'numerator', 'real', 'to_bytes', 'value']

ctx.channel.default_auto_archive_duration= AutoArchiveDuration.ONE_DAY```
frail gorge
#

well, that doesnt say its one day

#

unless you mean the final line, which is reassigning it to one day

#

you have an enum - i would suggest just directly printing it out instead of doing a type check

regal blade
#

yeah, that's what the last line is, just printing it

frail gorge
#

okay makes more sense

regal blade
#

print(f"{fname}: ctx.channel.default_auto_archive_duration=",ctx.channel.default_auto_archive_duration)

frail gorge
#

okay i have a theory

#

ipy assigns a default for default_auto_archive_duration thats indeed one day

#

for some reason channels can just not have a default archive duration value already filled in

#

hence the behavior

#

as for why one day - im pretty sure that was the default at some point

regal blade
#

oh, so it's likely a combination of issues. one being the library defaulting to one day, and two being the api not returning the proper info

frail gorge
#

yes, though knowing discord the api wont be fixed to return the correct info, so we're stuck fixing it ourselves

regal blade
#

meh, not going to concern myself with it. It's just one of those things I'll have to keep in mind if server admins change stuff.

#

Thanks much for the help Max and Astrea!

frail gorge
#

np!
time for another pr to my current pr list lmao
(unless someone steals it which like go ahead)