-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (29 loc) · 909 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import discord
import os
from discord.flags import Intents
from dotenv import load_dotenv
from time import sleep
import add_audio
load_dotenv()
client = discord.Client()
commands = add_audio.check()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
spl = message.content.split(" ")
for item in spl:
if item in commands:
vc = await message.author.voice.channel.connect()
print('Connected to voice')
vc.play(discord.FFmpegPCMAudio(
executable="F:\\FFmpeg\\bin\\ffmpeg.exe", source=commands.get(item)))
print('playing')
while vc.is_playing():
sleep(.1)
await vc.disconnect()
print('disconnected')
client.run(os.getenv('TOKEN'))