mirror of
https://github.com/jeantoulza/scplanner-discord
synced 2024-11-24 04:05:37 +01:00
Fixed bot
This commit is contained in:
parent
2c477f150a
commit
4bf1d397e4
14
bot.py
14
bot.py
@ -81,6 +81,8 @@ def auto(track_url):
|
|||||||
except:
|
except:
|
||||||
raise Exception("Could not determine logged in user...")
|
raise Exception("Could not determine logged in user...")
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
rep = br.open(BASE+"schedule")
|
rep = br.open(BASE+"schedule")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -114,13 +116,9 @@ def auto(track_url):
|
|||||||
raise Exception("Unknown error. Please fill an issue on https://github.com/jeantoulza/scplanner-discord.")
|
raise Exception("Unknown error. Please fill an issue on https://github.com/jeantoulza/scplanner-discord.")
|
||||||
type = rep_json[0]["type"]
|
type = rep_json[0]["type"]
|
||||||
if type == "success" and len(rep_json[0]["success_schedules"]) > 0:
|
if type == "success" and len(rep_json[0]["success_schedules"]) > 0:
|
||||||
group = rep_json[0]["success_schedules"][0]["group"]
|
url = rep_json[0]["success_schedules"]["links"].strip()
|
||||||
text = rep_json[0]["text"]
|
text = rep_json[0]["text"]
|
||||||
track = resolve(track_url)
|
return text+"\nSee {0}".format(url)
|
||||||
if track:
|
|
||||||
return text+"\nSee https://scplanner.net/calendar/reposts/{0}/{1}/{2}".format(soundcloud_id, track.id, group)
|
|
||||||
else:
|
|
||||||
raise Exception("Schedule was done but I could not find track :(")
|
|
||||||
else:
|
else:
|
||||||
raise Exception("Track not found, or something worse happened :(")
|
raise Exception("Track not found, or something worse happened :(")
|
||||||
|
|
||||||
@ -165,5 +163,5 @@ def start_bot():
|
|||||||
bot.run(config["CONFIG"]["bot_token"])
|
bot.run(config["CONFIG"]["bot_token"])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start_bot()
|
#start_bot()
|
||||||
#auto("https://soundcloud.com/toto/totooooo")
|
auto("https://soundcloud.com/toto/totooooo")
|
Loading…
Reference in New Issue
Block a user