File tree 2 files changed +5
-10
lines changed
2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change 6
6
from datetime import datetime
7
7
from re import sub , findall
8
8
from random import randrange
9
- from json import loads
10
- from requests import get
11
9
12
10
from user import User
13
11
@@ -171,14 +169,12 @@ class SocialCommand(Command):
171
169
user = User ()
172
170
173
171
def __call__ (self , args , data = None ):
174
- try :
175
- user_data = self .user .request ("GET" , "/channels/{channel}" .format (channel = data ['channel' ]), fields = 'user' )['user' ]
176
- except Exception :
177
- raise Exception ("Bad things went boom! (Invalid channel: {chan})" .format (chan = data ['channel' ]))
178
- return "Things when boom! Invalid channel {chan}" .format (chan = data ['channel' ])
179
- print (user_data )
172
+ social = self .user .request ("GET" , "/channels/{id}" .format (
173
+ id = data ['channel' ]), fields = 'user' )["user" ]["social" ]
174
+ if social :
175
+ return ', ' .join (': ' .join ((k .title (), social [k ])) for k in social )
176
+ return "No social services were found on the streamer's profile."
180
177
181
- return ' ' .join (user_data ['social' ].values ())
182
178
183
179
# #### TO BE REDONE IN USERS MODEL #### #
184
180
Original file line number Diff line number Diff line change 7
7
8
8
class User :
9
9
path = "https://beam.pro/api/v1"
10
- channel = ""
11
10
12
11
def __init__ (self , debug = "WARNING" , ** kwargs ):
13
12
self ._init_logger (debug )
You can’t perform that action at this time.
0 commit comments