Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc/threads: fix a few more bugs #1685

Merged
merged 6 commits into from
Jun 27, 2024

Conversation

SoggySaussages
Copy link
Contributor

@SoggySaussages SoggySaussages commented Jun 26, 2024

Fix the following bugs:

  • createThread auto archive duration argument not impacting the created thread
  • createThread not able to create announcement threads
  • editThread and closeThread not able to alter announcement threads
  • typo in create/editThread error

Signed-off-by: SoggySaussages vmdmaharaj@gmail.com

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
if duration < 60 || duration > 10080 {
return nil, errors.New("createThread 'auto_archive_duration' must be and integer between 60 and 10080")
start.AutoArchiveDuration = tmplToInt(opt)
if start.AutoArchiveDuration < 60 || start.AutoArchiveDuration > 10080 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this check exactly 60, 1440, 4320, and 10080, as stated in the thread metadata docs?
Currently giving any other value won't create the thread, with integers between 60 and 10080 failing silently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done this in 191fa78, I've also added a designated type and constants for auto archive duration for readability in 283301f.

Previously users could provide any integer between 60 and 10080 as a
duration. This caused createThread or editThread to fail given that
Discord only permits 60, 1440, 4320, *or* 10080. Now any non permissible
value errors.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
@ashishjh-bst ashishjh-bst merged commit ce8c7a6 into botlabs-gg:dev Jun 27, 2024
2 checks passed
ashishjh-bst pushed a commit to ashishjh-bst/yagpdb that referenced this pull request Jun 27, 2024
* cc/threads: fix createThread archive duration

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* cc/threads: allow creation of news threads

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* discrdgo: ChannelType.IsThread ret true for news

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* cc/threads: error typo

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* cc/threads: restrict auto archive dur

Previously users could provide any integer between 60 and 10080 as a
duration. This caused createThread or editThread to fail given that
Discord only permits 60, 1440, 4320, *or* 10080. Now any non permissible
value errors.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* discordgo: add type for auto archive

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

---------

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
ashishjh-bst pushed a commit to ashishjh-bst/yagpdb that referenced this pull request Jun 27, 2024
* cc/threads: fix createThread archive duration

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* cc/threads: allow creation of news threads

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* discrdgo: ChannelType.IsThread ret true for news

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* cc/threads: error typo

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* cc/threads: restrict auto archive dur

Previously users could provide any integer between 60 and 10080 as a
duration. This caused createThread or editThread to fail given that
Discord only permits 60, 1440, 4320, *or* 10080. Now any non permissible
value errors.

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

* discordgo: add type for auto archive

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>

---------

Signed-off-by: SoggySaussages <vmdmaharaj@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants