Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61c0e9bd62 |
+14
-7
@@ -479,6 +479,12 @@ def main():
|
||||
|
||||
@client.event
|
||||
async def on_ready() -> None:
|
||||
global user
|
||||
user=client.user
|
||||
config=load_settings()
|
||||
if('channel' in config):
|
||||
user=await client.get_user(config['channel'])
|
||||
await client.add_custom_event('on_chat_message',user,on_chat_message)
|
||||
print('astrolobot ready')
|
||||
while True:
|
||||
tokens=client.http.get_token(client.user.id)
|
||||
@@ -486,32 +492,32 @@ def main():
|
||||
tokens=refresh_tokens(tokens['refresh_token'])
|
||||
await client.authorize(tokens['access_token'],tokens['refresh_token'])
|
||||
|
||||
@client.event
|
||||
async def on_chat_message(data: eventsub.chat.MessageEvent):
|
||||
global user
|
||||
config=load_settings()
|
||||
if data['message']['text']==config['positions']:
|
||||
for line in get_positions_formatted().splitlines(False):
|
||||
await client.channel.chat.send_message(line,data['message_id'])
|
||||
await user.channel.chat.send_message(line,data['message_id'])
|
||||
return
|
||||
if data['message']['text']==config['transits']:
|
||||
for line in get_transits_formatted().splitlines(False):
|
||||
await client.channel.chat.send_message(line,data['message_id'])
|
||||
await user.channel.chat.send_message(line,data['message_id'])
|
||||
return
|
||||
if data['message']['text']==config['major_aspects']:
|
||||
for line in get_aspects_formatted().splitlines(False):
|
||||
await client.channel.chat.send_message(line,data['message_id'])
|
||||
await user.channel.chat.send_message(line,data['message_id'])
|
||||
return
|
||||
if data['message']['text']==config['minor_aspects']:
|
||||
for line in get_aspects_formatted(minor=True).splitlines(False):
|
||||
await client.channel.chat.send_message(line,data['message_id'])
|
||||
await user.channel.chat.send_message(line,data['message_id'])
|
||||
return
|
||||
if data['message']['text']==config['major_aspect_transits']:
|
||||
for line in get_aspect_transits_formatted().splitlines(False):
|
||||
await client.channel.chat.send_message(line,data['message_id'])
|
||||
await user.channel.chat.send_message(line,data['message_id'])
|
||||
return
|
||||
if data['message']['text']==config['minor_aspect_transits']:
|
||||
for line in get_aspect_transits_formatted(minor=True).splitlines(False):
|
||||
await client.channel.chat.send_message(line,data['message_id'])
|
||||
await user.channel.chat.send_message(line,data['message_id'])
|
||||
return
|
||||
|
||||
client.run(*tokens.values())
|
||||
@@ -562,6 +568,7 @@ def script_properties():
|
||||
properties=obspython.obs_properties_create()
|
||||
obspython.obs_properties_add_button(properties,'login','Login to Twitch',login)
|
||||
obspython.obs_properties_add_button(properties,'update','Check for Updates',obs_update)
|
||||
obspython.obs_properties_add_text(properties,'channel','channel name',obspython.OBS_TEXT_DEFAULT)
|
||||
obspython.obs_properties_add_text(properties,'commands','commands',obspython.OBS_TEXT_INFO)
|
||||
obspython.obs_properties_add_text(properties,'positions','positions',obspython.OBS_TEXT_DEFAULT)
|
||||
obspython.obs_properties_add_text(properties,'transits','transits',obspython.OBS_TEXT_DEFAULT)
|
||||
|
||||
Reference in New Issue
Block a user