summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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?