Skip to content

Commit

Permalink
Record sightings on a per-bot basis
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Jun 14, 2024
1 parent 1094eea commit 477449d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion database.pike
Original file line number Diff line number Diff line change
Expand Up @@ -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??
Expand Down
5 changes: 3 additions & 2 deletions poll.pike
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 477449d

Please sign in to comment.