40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
import sys
|
||
import threading
|
||
import logging
|
||
import discord
|
||
import ffmpeg
|
||
from discord import guild, FFmpegPCMAudio
|
||
|
||
from discord.ext import commands
|
||
|
||
threading.current_thread().name = "main"
|
||
logging.basicConfig(stream=sys.stdout, filemode='w', level='INFO',
|
||
format='%(asctime)s - %(levelname)s - %(threadName)s - %(message)s')
|
||
|
||
bot = commands.Bot(command_prefix='$')
|
||
|
||
|
||
@bot.event
|
||
async def on_voice_state_update(member, before, after):
|
||
channel = bot.get_channel(947075464256712724)
|
||
print(member)
|
||
_memb = 260050236813082624
|
||
if before.channel == None:
|
||
await channel.send(f'{member.mention} ах ты ебаглаз')
|
||
voice_client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild)
|
||
audio_source = FFmpegPCMAudio('audio/1.mp3')
|
||
if not voice_client.is_playing():
|
||
voice_client.play(audio_source, after=None)
|
||
if after.channel == None:
|
||
await channel.send(f'{member.mention} ты куда пошел?')
|
||
|
||
|
||
@bot.event
|
||
async def on_ready():
|
||
logging.info(f'Bot started')
|
||
|
||
|
||
bot.run('OTQ2ODE5MDA0MzE0NTcwODUy.YhkP6Q.dhFqi2MJMrxzHt5FtjK5Cl-5BI8')
|
||
|
||
# if __name__ == '__main__':
|