diff options
Diffstat (limited to 'npc/commands/discord.txt')
-rw-r--r-- | npc/commands/discord.txt | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/npc/commands/discord.txt b/npc/commands/discord.txt index 963acb4b3..a5773af77 100644 --- a/npc/commands/discord.txt +++ b/npc/commands/discord.txt @@ -91,8 +91,9 @@ OnCall: // Run SQL query (will halt execution on dupe) if (.@link) { if ($@HAS_API) { - apiasync("SQL", sprintf("UPDATE `discord` SET `discord_name` = '?1', `verified` = '0', `discord_id` = '' WHERE `account_id`='%d'", getcharid(3))); + apiasync("SQL", sprintf("UPDATE `discord` SET `discord_name` = '?1', `verified` = '0', `discord_id` = '?2' WHERE `account_id`='%d'", getcharid(3))); apiasync("SAD1", .@discord$); + apiasync("DISCORDID2", .@discord$); apiasync("SQLRUN", ""); } else { query_sql(sprintf("UPDATE `discord` SET `discord_name` = '%s', `verified` = '0', `discord_id` = '' WHERE `account_id`='%d'", @@ -100,8 +101,9 @@ OnCall: } } else { if ($@HAS_API) { - apiasync("SQL", sprintf("INSERT INTO `discord` (`discord_name`, `verified`, `discord_id`, `account_id`) VALUES ('?1', '0', '', '%d')", getcharid(3))); + apiasync("SQL", sprintf("INSERT INTO `discord` (`discord_name`, `verified`, `discord_id`, `account_id`) VALUES ('?1', '0', '?2', '%d')", getcharid(3))); apiasync("SAD1", .@discord$); + apiasync("DISCORDID2", .@discord$); apiasync("SQLRUN", ""); } else { query_sql(sprintf("INSERT INTO `discord` (`discord_name`, `verified`, `discord_id`, `account_id`) VALUES ('%s', '0', '', '%d')", @@ -126,10 +128,15 @@ OnCall: break; ///////////////////////////////////////////////////////////////////// case 2: - query_sql("DELETE FROM `discord` WHERE `account_id`='"+getcharid(3)+"'"); + if ($@HAS_API) { + apiasync("SQL", sprintf("DELETE FROM `discord` WHERE `account_id`='%d'", getcharid(3))); + apiasync("SQLRUN", ""); + } else { + query_sql("DELETE FROM `discord` WHERE `account_id`='"+getcharid(3)+"'"); + // Prevent setting a new linking right away + DISCTRL=gettimeparam(GETTIME_DAYOFMONTH)+1; + } .@discord$=""; - // Prevent setting a new linking right away - DISCTRL=gettimeparam(GETTIME_DAYOFMONTH)+1; // Update Cache htput(.discmem, str(getcharid(3)), ""); // TODO: Remove Adventurer role? |