33 lines
		
	
	
	
		
			893 B
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			893 B
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
| #!/usr/bin/env python3
 | |
| from discord.ext import commands
 | |
| import hrochobot.utils.data as data
 | |
| import logging
 | |
| import os
 | |
| 
 | |
| data.DATA_FOLDER = os.environ.get("HROCHOBOT_DATA", 'data')
 | |
| LOG_FOLDER = os.environ.get("HROCHOBOT_LOG", '.')
 | |
| 
 | |
| logger = logging.getLogger('hrochobot')
 | |
| logger.setLevel(logging.INFO)
 | |
| handler = logging.FileHandler(filename=f'{LOG_FOLDER}/hrochobot.log', encoding='utf-8', mode='w')
 | |
| handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
 | |
| logger.addHandler(handler)
 | |
| 
 | |
| CONFIG = data.load_json("config")
 | |
| 
 | |
| bot = commands.Bot()
 | |
| 
 | |
| cogs_list = [
 | |
|     'basic',
 | |
|     'roles',
 | |
|     'ksp',
 | |
| ]
 | |
| 
 | |
| for cog in cogs_list:
 | |
|     bot.load_extension(f'hrochobot.cogs.{cog}')
 | |
| 
 | |
| @bot.listen('on_interaction')
 | |
| async def statistics(interaction):
 | |
|     logger.info(f"{interaction.user} ({interaction.user.id}) used command {interaction.data['name']}.")
 | |
| 
 | |
| bot.run(CONFIG["token"])
 |