forked from DenverCoder1/dev-pro-tips-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
49 lines (35 loc) · 1.15 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
import os
import aiohttp
import nextcord
from nextcord.ext import commands
import config
def main():
# allows privledged intents for monitoring members joining, roles editing, and role assignments
intents = nextcord.Intents.default()
intents.guilds = True
intents.members = True
activity = nextcord.Activity(
type=nextcord.ActivityType.listening, name=f"{config.PREFIX}help"
)
bot = commands.Bot(
command_prefix=commands.when_mentioned_or(config.PREFIX),
intents=intents,
activity=activity,
owner_id=config.OWNER_ID,
)
# boolean that will be set to true when views are added
bot.persistent_views_added = False
@bot.event
async def on_ready():
print(f"{bot.user.name} has connected to Discord.")
# load all cogs
for folder in os.listdir("cogs"):
if os.path.exists(os.path.join("cogs", folder, "cog.py")):
bot.load_extension(f"cogs.{folder}.cog")
async def startup():
bot.session = aiohttp.ClientSession()
bot.loop.create_task(startup())
# run the bot
bot.run(config.BOT_TOKEN)
if __name__ == "__main__":
main()