-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbot.py
55 lines (44 loc) · 1.23 KB
/
bot.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
dThis file is the main entry point of the bot
"""
from multiprocessing.util import debug
import discord
import os
from src.get_all import *
import re
from dotenv import load_dotenv
from discord.ext import commands
from src.utils import searchSong
from src.songs_queue import Songs_Queue
from src.songs_cog import Songs
load_dotenv('.env')
TOKEN = os.getenv('DISCORD_TOKEN')
# This can be obtained using ctx.message.author.voice.channel
VOICE_CHANNEL_ID = 1017135653789646851
intents = discord.Intents.all()
intents.members = True
client = commands.Bot(command_prefix='/', intents=intents)
"""
Function that gets executed once the bot is initialized
"""
@client.event
async def on_ready():
voice_channel = client.get_channel(VOICE_CHANNEL_ID)
if client.user not in voice_channel.members:
await voice_channel.connect()
await client.load_extension("src.songs_cog")
"""
Function that is executed once any message is received by the bot
"""
@client.event
async def on_message(message):
if message.author == client.user:
return
options = set()
if message.channel.name == 'general':
user_message = str(message.content)
await client.process_commands(message)
"""
Start the bot
"""
client.run(TOKEN)