Gacha game centered around vore.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vore-gacha/migrations/committed/000012-fix-command_join-aga...

34 lines
1.2 KiB

--! Previous: sha1:defb8b93ce936f1bb553abb90aaa6ecd5a00b1bc
--! Hash: sha1:00899815dc03fa792300ff69dde9d17756448635
--! Message: Fix Command_Join again
--- Runs the full /join command.
--- Error codes:
--- VGBCG: Bad channel (game). This is not a valid channel to send game commands in.
--- VGBGG: Bad guild (game). This is not a valid guild to send game commands in.
CREATE OR REPLACE FUNCTION Command_Join(
IN requestedChannel DiscordChannel.DiscordId%TYPE,
IN requestedGuild DiscordChannel.GuildId%TYPE,
IN forId DiscordUser.discordId%TYPE,
IN newUsername DiscordUser.username%TYPE,
IN newDiscriminator DiscordUser.discriminator%TYPE,
IN newPlayerName Player.name%TYPE,
IN newGenderId Gender.id%TYPE,
OUT resultId Player.id%TYPE,
OUT newPlayerName Player.name%TYPE,
OUT newGenderName Gender.name%TYPE,
OUT wasCreated BOOLEAN
)
RETURNS RECORD
STRICT
VOLATILE
AS
$$
CALL CheckGameCommandIn(requestedChannel, requestedGuild);
SELECT NewRegistration.resultId, newPlayerName, Gender.name, NewRegistration.wasCreated
FROM UpdatePlayerRegistration(forId, newUsername, newDiscriminator, newPlayerName, newGenderId) AS NewRegistration
LEFT JOIN Gender ON Gender.id = newGenderId
$$
LANGUAGE 'sql';