-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (25 loc) · 831 Bytes
/
main.py
File metadata and controls
32 lines (25 loc) · 831 Bytes
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
import json
import os
import discord
import discord.ext
from discord_components import DiscordComponents
from discord.ext import commands
bot = commands.Bot(command_prefix = "e!", case_insensitive = True, help_command = None)
@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Game("having so much sex rn"))
await load_cogs()
DiscordComponents(bot)
print("Logged in as {0.user}".format(bot))
async def load_cogs():
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
# Gets token to authenticate bot
with open("token.json") as bot_token:
data = json.load(bot_token)
token = data["token"]
@bot.command()
async def ping(ctx):
await ctx.send(f':ping_pong: Pong! {round(bot.latency * 1000)}ms')
bot.run(token)