15 Commits

Author SHA1 Message Date
Zane Helton
33fde3bc4a Fix the creation of guilds from templates
The biggest hold-up was missing fields (`premium_tier`,
`welcome_screen`, etc.) but it looks like someone has provided a
helpful function called `createGuild(...)` to provide sensible default
values.

This commit fixes the errors related to creating a guild from a
template. I've also refactored the code to include roles and channels in
the template.

To make sure that the @everyone role is cloned correctly, when
creating the guild from a template, we check if the role's ID
matches the template's `source_guild_id`. If it does, we set the
@everyone role to the new guild's ID.
2025-06-29 13:27:14 +10:00
Zane Helton
eec2a8ba85 Set premium_tier to 0 when creating guild from template
I think we'll need to discuss the proper way to provide default values
here. `premium_tier` for example should never be provided from the
template so it's fine going after the spread operator.

This commit still doesn't allow guilds to be created from template
because the next error is that `welcome_screen` doesn't exist. Our
options:

1. Provide default values in the ORM
2. Provide default values in the guild creation process
3. Throw an error if the template is missing values

Resolves: #1283 but creates a new issue
2025-06-29 13:27:14 +10:00
Zane Helton
ff692c19b7 Await guild creation to fix a race condition
`Promise.all(...)` runs these simultaneously, yet role depends on the
guild to be created first. This can lead to a race condition. I've
awaited role creation too because the call to `Member.addToGuild(...)`
relies on the role to be created.
2025-06-29 13:27:14 +10:00
Emma [it/its]@Rory&
168758924c Update some patches, switch to node-fetch-commonjs, more updates 2024-10-28 00:32:15 +01:00
Madeline
4ecee6b291
fix typos 2023-04-14 22:26:11 +10:00
Puyodead1
c2ce88dee7
guilds 2023-04-13 15:28:41 -04:00
Puyodead1
6b3a3b750f
fixing lots of openapi crap 2023-04-13 15:20:10 -04:00
Madeline
095cbf7b20
Remove ALL fosscord mentions 2023-03-31 15:52:33 +11:00
Madeline
8b2faf0b18
SPACEBAR 2023-03-31 02:15:42 +11:00
Madeline
64e747a4d2
SPACEBAR 2023-03-31 02:05:02 +11:00
Madeline
084dc0be08 Add ESLint (#941)
* Add eslint, switch to lint-staged for precommit

* Fix all ESLint errors

* Update GH workflow to check prettier and eslint
2023-01-20 18:10:47 +11:00
Madeline
0e7f127ece Script to add license preamble to each file. Also, does that. (#935)
* Add script to automatically add license to each file

* Add license preamble to each file.

* Fix existing preamble detection breaking due to line endings. Git :(

* Prevent license from being added to code with other licenses
2023-01-18 13:05:49 +11:00
Madeline
99ee7e9400 Prettier 2022-09-26 22:41:21 +10:00
Madeline
849b257db7 Move schemas to /src/util/schemas 2022-09-26 22:08:14 +10:00
Madeline
f44f5d7ac2 Refactor to mono-repo + upgrade packages 2022-09-25 23:35:18 +10:00