v1.0 stable features
This commit is contained in:
@@ -1,21 +1,27 @@
|
||||
import os
|
||||
import discord
|
||||
import emotes
|
||||
from datetime import datetime
|
||||
from dotenv import load_dotenv
|
||||
import emotes
|
||||
import help
|
||||
from utils import debug
|
||||
|
||||
load_dotenv()
|
||||
token = os.getenv('DISCORD_TOKEN')
|
||||
|
||||
client = discord.Client()
|
||||
|
||||
VERSION = "1.0"
|
||||
|
||||
t0 = datetime.now()
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
await client.change_presence(
|
||||
activity=discord.Game("%emotes help"),
|
||||
activity=discord.Game(f"v{VERSION} | %help"),
|
||||
status=discord.Status.online
|
||||
)
|
||||
print(f'{client.user} has connected to Discord\nto the following guilds:')
|
||||
print(f'{client.user} v{VERSION} has connected to Discord\nto the following guilds:')
|
||||
for guild in client.guilds:
|
||||
print(f'- {guild.name}(id: {guild.id})')
|
||||
|
||||
@@ -25,9 +31,26 @@ async def on_message(message):
|
||||
if message.author == client.user:
|
||||
return
|
||||
|
||||
permissions = message.channel.permissions_for(message.guild.me)
|
||||
if not permissions.send_messages:
|
||||
debug(message, f"missing 'send_messages' permission")
|
||||
await message.author.create_dm()
|
||||
await message.author.dm_channel.send(
|
||||
f"Hi, this bot doesn\'t have the permission to send a message to"
|
||||
f" #{message.channel} in server '{message.guild}'")
|
||||
return
|
||||
|
||||
args = message.content.split(" ")
|
||||
|
||||
if args[0] == "%info":
|
||||
debug(message, f"command '{message.content}'")
|
||||
await message.channel.send(f"Discord Analyst v{VERSION} started at {t0.isoformat()}")
|
||||
|
||||
if args[0] == "%help":
|
||||
await help.compute(message, args)
|
||||
|
||||
if args[0] == "%emotes":
|
||||
await emotes.compute(client, message, args)
|
||||
await emotes.compute(message, args)
|
||||
|
||||
|
||||
client.run(token)
|
||||
|
||||
Reference in New Issue
Block a user