-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
65 lines (51 loc) · 1.64 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import discord, os, time, json
from dotenv import load_dotenv, set_key
from discord.ext import commands
from pathlib import Path
from config import setup
os.system("cls")
print("""
Måtta Discord Bot
If you're facing any problems, please post an issue
on the GitHub repo, and/or alert us in the
Discord server.
GitHub repo:
- https://github.com/luqmanity/matta
Nytra Discord server:
- https://discord.gg/7w8b6MMXBy\n""")
load_dotenv("data/.env") # Loading the .env
# Required files exists
print("Required files exists. Deploying bot...\n")
TOKEN = str(os.getenv("token"))
if __name__ == "__main__":
bot = discord.Bot(
intents=discord.Intents.all()
)
# Startup configs
startup_time = time.time()
@bot.event
async def on_ready():
# Setting the bot status
await bot.change_presence(
status=discord.Status.do_not_disturb,
activity=discord.Activity(
type=discord.ActivityType.playing,
name="Hej då! /help"
)
)
# Checking how long to run
startup_duration = round(time.time() - startup_time, 4)
print(f"{bot.user} is online, took {startup_duration}s\n")
# Cogs
bot.load_extension("scripts.modules.autoresponses")
bot.load_extension("scripts.modules.tools")
bot.load_extension("scripts.modules.moderation")
bot.load_extension("scripts.modules.help")
# Cooldown Management
@bot.event
async def on_application_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
await ctx.send(error)
else:
raise error
bot.run(TOKEN)