-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (37 loc) · 1.17 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
import discord
import os
import json
from dotenv import load_dotenv
from discord.ext import commands
intents = discord.Intents.all()
env_vars = load_dotenv('.env')
BOT = commands.Bot(command_prefix='!!', intents=intents)
@BOT.event
async def on_ready():
await BOT.change_presence(status=discord.Status.online,
activity=discord.Game('with alligators | !!help'))
print('{0.user} reporting for duty'.format(BOT))
@BOT.event
async def on_message(message):
if message.author == BOT.user:
return ()
print(f'Message from {message.author}: {message.content}')
await BOT.process_commands(message)
@BOT.event
async def setup_hook():
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
await BOT.load_extension(f'cogs.{filename[:-3]}')
@BOT.event
async def on_presence_update(before, after):
game = str(after.activity)
userId = after.id
user = BOT.get_user(userId)
if "overwatch" in game:
print("overwatch detected")
# await user.send("get off overwatch")
@BOT.command()
async def ping(ctx):
await ctx.send('pong')
token = os.environ.get("Token")
BOT.run(token)