Files
discord_bot/main.py
2022-02-28 02:40:59 +03:00

40 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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__':