You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If I use client.app.bsky.graph.listitem.create() to try to add a user to a moderated list (Block list) it says its successful. But the user never gets added to the moderated list. If i use the same code to add a user to a normal list it seems to work just fine.
To Reproduce
create a moderated list
get the at:// for the moderated list
create a models.AppBskyGraphListitem.Record
run a client.app.bsky.graph.listitem.create(client.me.did,list_record)
Expected behavior
User gets added to list or atproto raises an exception of some kind.
def add_user_to_blocklist(client=None, tgtUserHandle=None, tgtUserDID=None, listURI=None, dryRun=False):
# It only works for normal lists, not moderation lists
list_record = models.AppBskyGraphListitem.Record(
subject=tgtUserDID,
created_at=client.get_current_time_iso(),
list=listURI,
)
if not dryRun:
try:
client.app.bsky.graph.listitem.create(client.me.did,list_record)
print( f'>> Added user: {tgtUserHandle} with DID: {tgtUserDID} to block list ${listURI}' )
except Exception as e:
print( f'ERROR: Somethign went wrong: {e}')
The text was updated successfully, but these errors were encountered:
I have tested. Everything works good. Verify what did do you pass; verify URIs; verify that you own this mod list; maybe you are logged in into wrong account and etc. Here is my coded that I used to test it:
defmain() ->None:
client=Client()
client.login(os.environ['USERNAME'], os.environ['PASSWORD'])
# https://bsky.app/profile/test.marshal.dev/lists/3k5z5k4k6qw2rmod_list_uri='at://did:plc:kvwvcn5iqfooopmyzvb4qzba/app.bsky.graph.list/3k5z5k4k6qw2r'mod_list_owner=AtUri.from_str(mod_list_uri).hostuser_to_add=IdResolver().handle.resolve('test.marshal.dev')
print(f'Adding {user_to_add} to the list {mod_list_uri} (owned by {mod_list_owner})')
created_list_item=client.app.bsky.graph.listitem.create(mod_list_owner, models.AppBskyGraphListitem.Record(
list=mod_list_uri,
subject=user_to_add,
created_at=client.get_current_time_iso(),
))
print(f'Created list item: CID={created_list_item.cid}; URI: {created_list_item.uri}')
sleep(3) # sleep for 3 sec because it takes some time to update the list for the backendmod_list=client.app.bsky.graph.get_list(models.AppBskyGraphGetList.Params(list=mod_list_uri))
mod_list_users= [item.subject.didforiteminmod_list.items]
print(f'List users: {mod_list_users}')
assertuser_to_addinmod_list_users, f'User {user_to_add} not found in the list {mod_list_uri}'deleted_success=client.app.bsky.graph.listitem.delete(mod_list_owner, AtUri.from_str(created_list_item.uri).rkey)
print(f'Deleted list item: {deleted_success}')
Describe the bug
If I use
client.app.bsky.graph.listitem.create()
to try to add a user to a moderated list (Block list) it says its successful. But the user never gets added to the moderated list. If i use the same code to add a user to a normal list it seems to work just fine.To Reproduce
at://
for the moderated listmodels.AppBskyGraphListitem.Record
client.app.bsky.graph.listitem.create(client.me.did,list_record)
Expected behavior
User gets added to list or atproto raises an exception of some kind.
Details
Python 3.12.7
pip modoles
Additional context
the relevant code chunk
The text was updated successfully, but these errors were encountered: