- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakeUserMod.py
More file actions
Latest commit
34 lines (27 loc) · 1.12 KB
/
Copy pathmakeUserMod.py
File metadata and controls
34 lines (27 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
# -*- coding: UTF8 -*-
frompythorheadimportLemmy
print("This script gives a target bot moderator rights on a target community,")
print("without the bot having to post there first.")
ifinput("Are you sure you want to do that? (y/N) ").strip() notin ["y","Y"]:
print("Aborting")
exit()
instanceUrl=input("Instance URL: ")
currentUser=input("Your user name: ")
currentPass=input("Your password: ")
botName=input("Bot user name: ")
community=input("Community name: ")
print()
print(f"Instance URL: {instanceUrl}")
print(f"Your user name: {currentUser}")
print(f"Your password: {currentPass}")
print(f"Bot user name: {botName}")
print(f"Community name: {community}")
ifinput("Is everything correct? (y/N) ").strip() notin ["y","Y"]:
print("Aborting")
exit()
lemmy=Lemmy(instanceUrl)
lemmy.log_in(currentUser, currentPass)
communityId=lemmy.community.get(name=community)["community_view"]["community"]["id"]
personId=lemmy.user.get(username=botName)["person_view"]["person"]["id"]
lemmy.community.add_mod_to_community(added=True, community_id=communityId, person_id=personId)