File tree Expand file tree Collapse file tree 4 files changed +13
-21
lines changed Expand file tree Collapse file tree 4 files changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,7 @@ Create a `config.yaml` and a `auth.yaml` file in `./config/`. Enter the credenti
31
31
# Credentials for your bot account
32
32
bot_account:
33
33
server: "mastodon.example.com"
34
- email: "hypebot@example.com"
35
- password: "averylongandsecurepassword"
34
+ access_token: "Create a new application in your bot account at Preferences -> Development"
36
35
` ` `
37
36
38
37
` config.yaml`
@@ -46,7 +45,7 @@ profile_prefix: "I am boosting trending posts from:"
46
45
47
46
# profile fields to fill in
48
47
fields:
49
- code: https://github.com/tante /hype
48
+ code: https://github.com/v411e /hype
50
49
operator: "YOUR HANDLE HERE"
51
50
52
51
# Define subscribed instances and
Original file line number Diff line number Diff line change 1
1
# Credentials for your bot account
2
2
bot_account :
3
3
server : " "
4
- email : " "
5
- password : " "
4
+ access_token : " "
Original file line number Diff line number Diff line change 6
6
7
7
class BotAccount :
8
8
server : str
9
- email : str
10
- password : str
9
+ access_token : str
11
10
12
- def __init__ (self , server : str , email : str , password : str ) -> None :
11
+ def __init__ (self , server : str , access_token : str ) -> None :
13
12
self .server = server
14
- self .email = email
15
- self .password = password
13
+ self .access_token = access_token
16
14
17
15
def __repr__ (self ) -> str :
18
- return f"server: { self .server } , email : { self .email } , password: { self . password } "
16
+ return f"server: { self .server } , access_token : { self .access_token } "
19
17
20
18
21
19
class Instance :
@@ -53,13 +51,11 @@ def __init__(self):
53
51
config
54
52
and config .get ("bot_account" )
55
53
and config ["bot_account" ].get ("server" )
56
- and config ["bot_account" ].get ("email" )
57
- and config ["bot_account" ].get ("password" )
54
+ and config ["bot_account" ].get ("access_token" )
58
55
):
59
56
self .bot_account = BotAccount (
60
57
server = config ["bot_account" ]["server" ],
61
- email = config ["bot_account" ]["email" ],
62
- password = config ["bot_account" ]["password" ],
58
+ access_token = config ["bot_account" ]["access_token" ],
63
59
)
64
60
else :
65
61
logging .getLogger ("Config" ).error (config )
Original file line number Diff line number Diff line change @@ -20,13 +20,11 @@ def __init__(self, config: Config) -> None:
20
20
self .log .info ("Config loaded" )
21
21
22
22
def login (self ):
23
- self .client = self .init_client (self .config .bot_account .server )
24
23
self .log .info (f"Logging in to { self .config .bot_account .server } " )
25
- self .client .log_in (
26
- self .config .bot_account .email ,
27
- self .config .bot_account .password ,
28
- to_file = f"secrets/{ self .config .bot_account .server } _usercred.secret" ,
29
- )
24
+ self .client = Mastodon (
25
+ api_base_url = self .config .bot_account .server ,
26
+ access_token = self .config .bot_account .access_token
27
+ )
30
28
31
29
def update_profile (self ):
32
30
self .log .info ("Update bot profile" )
You can’t perform that action at this time.
0 commit comments