This commit is contained in:
aliasless 2020-04-11 07:42:09 +00:00
parent b7fadc0620
commit e7b9125f3c
1 changed files with 15 additions and 8 deletions

View File

@ -12,6 +12,9 @@ ROOT = "/home/bot/ticker"
SEGUIS = 665399296522321942
GOONS = 499822662281854996
MATT = 150791815723876352
DAD = 509547108907614208
SMOKEYS = 673203690672357422
RETARD = 695090043609415740
client = discord.Client()
c = CurrencyRates()
@ -80,6 +83,9 @@ async def on_ready():
# add afk message
@client.event
async def on_voice_state_update(member, before, after):
if member.id == MATT and after.channel and after.channel.id == SMOKEYS:
await member.move_to(client.get_channel(RETARD))
# only run on moves
if before.channel and after.channel:
# moves to the afk channel
@ -90,21 +96,22 @@ async def on_voice_state_update(member, before, after):
# ban league
@client.event
async def on_member_update(before, after):
# try to get the name of the before activity
before_name = None
# literally any of these fields might not exist and python has no safe navigation
# nor does it have pattern matching usable for this purpose
# guess i'll die
before_name = None
if before and before.activity and before.activity.type == discord.ActivityType.playing and before.activity.name:
before_name = before.activity.name
after_name = None
if after and after.activity and after.activity.type == discord.ActivityType.playing and after.activity.name:
if before_name != after.activity.name:
if after.activity.name == "League of Legends" and after.voice:
file_name = to_tts("Stop playing League, " + after.display_name)
await add_event(file_name, after.voice.channel)
after_name = after.activity.name
if before_name != after_name:
if after_name == "League of Legends" and after.voice:
file_name = to_tts("Stop playing League, " + after.display_name)
await add_event(file_name, after.voice.channel)
client.loop.create_task(ticker_update())
# either matts channel, or the most active channel