summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-05-08 23:40:11 -0300
committerJesusaves <cpntb1@ymail.com>2022-05-08 23:40:11 -0300
commitfbdcd2ee71d1aa32eedc55e17adf57a39e0974b2 (patch)
tree806fa5bd1522b8465d2a25ac429616ccd62e4f54
parent8d1ae4685fd560c0de3fea9268787acf536d001b (diff)
downloadserverdata-fbdcd2ee71d1aa32eedc55e17adf57a39e0974b2.tar.gz
serverdata-fbdcd2ee71d1aa32eedc55e17adf57a39e0974b2.tar.bz2
serverdata-fbdcd2ee71d1aa32eedc55e17adf57a39e0974b2.tar.xz
serverdata-fbdcd2ee71d1aa32eedc55e17adf57a39e0974b2.zip
Modernize unlinking as well, and prepare to get Discord numeric ID laterâ„¢
The numeric ID allows you to change nickname without updating anything
-rwxr-xr-xlogmaster.py8
-rw-r--r--npc/commands/discord.txt17
2 files changed, 20 insertions, 5 deletions
diff --git a/logmaster.py b/logmaster.py
index 89071ffa3..a8afa075e 100755
--- a/logmaster.py
+++ b/logmaster.py
@@ -185,6 +185,14 @@ while running:
w.execute(bf)
#stdout("Query OK: %s" % bf)
bf=""
+ ## Command: DISCORDID
+ ## Description: Replaces "?" with the Discord ID
+ ## For the associated argument.
+ ## Requires the API (WIP)
+ elif cmd == "DISCORDID":
+ ## FIXME: Query the API
+ bf=bf.replace("?%s" % cmd.replace("DISCORDID", ""), "")
+ pass
## Command: PING
## Description: Does nothing
elif cmd == "PING":
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?