-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
41 lines (30 loc) · 1.01 KB
/
bot.py
File metadata and controls
41 lines (30 loc) · 1.01 KB
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
import asyncio
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
intents.voice_states = True
bot = commands.Bot(command_prefix=os.getenv("COMMAND_PREFIX", "!"), intents=intents)
@bot.event
async def on_ready():
print(f"SpinLocal online as {bot.user} (ID: {bot.user.id})")
print(f"discord.py version: {discord.__version__}")
print("------")
@bot.command()
async def ping(ctx):
await ctx.send(f"Pong! Latency: {round(bot.latency * 1000)}ms")
async def main():
async with bot:
await bot.load_extension("cogs.music")
await bot.load_extension("cogs.playlists")
token = os.getenv("DISCORD_TOKEN")
if not token or token == "your_discord_bot_token_here":
print("ERROR: Add your DISCORD_TOKEN to the .env file and restart.")
return
await bot.start(token)
if __name__ == "__main__":
asyncio.run(main())