diff --git a/database.pike b/database.pike index 2fd4f1cb..c8e676c1 100644 --- a/database.pike +++ b/database.pike @@ -105,7 +105,7 @@ constant tables = ([ "login text not null", "bot text not null", "sighted timestamp with time zone not null default now()", - " primary key (twitchid, login)", + " primary key (twitchid, login, bot)", }), ]); //TODO: Have other modules submit requests for configs to be precached?? diff --git a/poll.pike b/poll.pike index 988a480d..9a4ffc9b 100644 --- a/poll.pike +++ b/poll.pike @@ -112,10 +112,11 @@ __async__ void get_credentials() { @retain: mapping recent_user_sightings = ([]); //Map a user ID (int) to a login @export: void notice_user_name(string login, string|int id) { if (!login) return; + string bot = G->G->instance_config->local_address; if (!bot) return; if (recent_user_sightings[(int)id] == login) return; recent_user_sightings[(int)id] = login; - //G->G->DB->save_sql("insert into stillebot.user_login_sightings (twitchid, login) values (:id, :login) on conflict do nothing", - // (["id": id, "login": lower_case(login)])); + G->G->DB->save_sql("insert into stillebot.user_login_sightings (twitchid, login, bot) values (:id, :login, :bot) on conflict do nothing", + (["id": id, "login": lower_case(login), "bot": bot])); } @export: __async__ array(mapping) get_helix_paginated(string url, mapping|void query, mapping|void headers, mapping|void options, int|void debug)