-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.py
31 lines (24 loc) · 1.09 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
import discord
from discord.ext import commands
from classes.session import NewSession
import asyncio
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='$', intents=intents)
_channel = bot.get_channel(895221843252887602)
@bot.event
async def on_ready():
channel = bot.get_channel(895221843252887602)
global _channel
_channel = channel
await bot.change_presence(status=discord.Status.online, activity=discord.Activity(type=2, name="User Commands"))
NewSession(channel=_channel, me=isMe, loop=bot.loop)
def isMe(m):
return m.author == bot.user
async def changeStatus(title):
await bot.change_presence(status=discord.Status.online, activity=discord.Activity(type=1, name=title))
def sendMessage(content=None, view=None, embed=None):
asyncio.run_coroutine_threadsafe(sendMess(content=content, view=view, embed=embed), bot.loop)
async def sendMess(content=None, view=None, embed=None):
_channel.send(content=content, view=view, embed=embed)
bot.run(open("/usr/src/app/secrets/bot-tokens/prod.txt").readline().strip())