ban league

This commit is contained in:
aliasless 2020-04-11 06:22:57 +00:00
parent ec7ef7a55f
commit 21dff32fcb
1 changed files with 12 additions and 17 deletions

View File

@ -82,29 +82,24 @@ async def on_voice_state_update(member, before, after):
# only run on moves
if before.channel and after.channel:
# moves to the afk channel
if after.channel.id == member.guild.afk_channel.id:
if member.guild.afk_channel and after.channel.id == member.guild.afk_channel.id:
file_name = to_tts(member.display_name + "はretard dimensionに移動しました")
await add_event(file_name, voice_channel)
await add_event(file_name, before.channel)
# ban league
@client.event
async def on_member_update(before, after):
if after.activity.type == discord.ActivityType.playing:
voice_channel = (after.voice.channel if after.voice.channel else None) if after.voice else None
# this entire block implies that after is a game, so it definitely has a name
# before might not be a game, and might not have a name.
before_name = None
if before.activity.type == discord.ActivityType.playing:
before_name = before.activity.name
# if a player starts playing league
if after.activity.name != before_name:
if after.activity.name == "League of Legends":
print("someone has started playing league uwu")
file_name = to_tts("Stop playing League, " + after.display_name, lang = 'en')
await add_event(file_name, voice_channel)
# try to get the name of the before activity
before_name = None
if before and before.activity and before.activity.type == discord.ActivityType.playing and before.activity.name:
before_name = before.activity.name
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)
client.loop.create_task(ticker_update())
# either matts channel, or the most active channel