What is Nostr?
laanwj /
npub1p23…rnl6
2024-11-10 09:20:13
in reply to nevent1q…rhpw

laanwj on Nostr: currently i have a script that is periodically run and deletes certain bots from the ...

currently i have a script that is periodically run and deletes certain bots from the sqlite database, which works

===
#!/usr/bin/env python3
import json
import sqlite3
import sys

from nostr.util import decode

def make_db_connection():
con = sqlite3.connect(os.path.join(os.getenv("HOME"), "data", "nostr.db"))
con.execute('PRAGMA foreign_keys = ON')
cursor = con.cursor()
return (con, cursor)

conn, cursor = make_db_connection()

junk = [
...
]

for npub in junk:
author = decode(npub)['pubkey']
res = cursor.execute("DELETE FROM event WHERE author=?", (author, ))

conn.commit()
===

but a way to reject them upfront would be better 🙂 there's the "event admission server" gRPC functionality that's probably intended to be used for scenarios like this... but haven't really looked into it, kinda hesitant to add more moving parts
Author Public Key
npub1p23eukh0nxsqpfaakz6fj9vvj27y4gs0kevnrffdq4d4adkl7uuq7crnl6