-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatGTP.py
36 lines (29 loc) · 1.13 KB
/
chatGTP.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
''' WORKING EXAMPLE '''
### this code was very much generated by chatGPT a long time ago, it is the base for main.py ###############3
import discord
import asyncio
intents = discord.Intents.default()
intents.typing = True
intents.voice_states = True
intents.message_content = True
intents.messages = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!play'):
# Join the voice channel that the controlling user is connected to
voice_channel = message.author.voice.channel
vc = await voice_channel.connect()
# Play the MP3 file
vc.play(discord.FFmpegPCMAudio("./bruh.mp3", executable="C:\\ffmpeg-5.1.2-essentials_build\\bin\\ffmpeg.exe"))
await message.channel.send("Playing bruh")
while vc.is_playing():
await asyncio.sleep(1)
vc.stop()
await vc.disconnect()
client.run('NjkzNTIzNTg4NDg5MTUwNTky.GOc3Yi.WjNvCKQzJu4ok4g50nTQ17X7H6FaIoTI2Fqvhg')