Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

load only iem_owned twitter info #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/iembot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,12 @@ def load_twitter_from_db(txn, bot):
"""Load twitter config from database"""
# Don't waste time by loading up subs from unauthed users
txn.execute(
f"select s.user_id, channel from {bot.name}_twitter_subs s "
"JOIN iembot_twitter_oauth o on (s.user_id = o.user_id) "
"WHERE s.user_id is not null and s.channel is not null "
"and o.access_token is not null and not o.disabled"
"""
select s.user_id, channel from iembot_twitter_subs s
JOIN iembot_twitter_oauth o on (s.user_id = o.user_id)
WHERE s.user_id is not null and s.channel is not null
and o.access_token is not null and not o.disabled and o.iem_owned
"""
)
twrt = {}
for row in txn.fetchall():
Expand All @@ -506,11 +508,13 @@ def load_twitter_from_db(txn, bot):

twusers = {}
txn.execute(
"SELECT user_id, access_token, access_token_secret, screen_name, "
"iem_owned from "
f"{bot.name}_twitter_oauth WHERE access_token is not null and "
"access_token_secret is not null and user_id is not null and "
"screen_name is not null and not disabled"
"""
SELECT user_id, access_token, access_token_secret, screen_name,
iem_owned from
iembot_twitter_oauth WHERE access_token is not null and
access_token_secret is not null and user_id is not null and
screen_name is not null and not disabled and iem_owned
"""
)
for row in txn.fetchall():
user_id = row["user_id"]
Expand Down