40 lines
1.0 KiB
Python
Executable File
40 lines
1.0 KiB
Python
Executable File
#!/usr/bin/python3
|
|
import discord
|
|
import os
|
|
import sys
|
|
import logging
|
|
|
|
from config import config
|
|
from language_parser import parser as lang_parser
|
|
#from command_parser import parser as cmd_parser
|
|
|
|
intents = discord.Intents.default()
|
|
client = discord.Client(intents=intents)
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
@client.event
|
|
async def on_ready():
|
|
logging.info("Logged in as {0.user}".format(client))
|
|
# Set bot status
|
|
await client.change_presence(activity=discord.Game(name=config["discord.status"]))
|
|
|
|
@client.event
|
|
async def on_message(message):
|
|
logging.info(f"Message received : {message.content}")
|
|
#if message.author == client.user:
|
|
# return
|
|
if len(message.content) == 0: # Ignore empty messages
|
|
return
|
|
#if message.content.startswith(config["discord.prefix"]):
|
|
# await cmd_parser(client, message)
|
|
else:
|
|
await lang_parser(client, message)
|
|
|
|
def main() -> int:
|
|
logging.info("Starting bot...")
|
|
client.run(config["discord.token"])
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|