Install as Python package
This commit is contained in:
parent
2b8d0a6b15
commit
df44328c35
7 changed files with 30 additions and 7 deletions
|
@ -1,11 +1,15 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import utils.data as data
|
import hrochobot.utils.data as data
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
logger = logging.getLogger('discord')
|
data.DATA_FOLDER = os.environ.get("HROCHOBOT_DATA", 'data')
|
||||||
|
LOG_FOLDER = os.environ.get("HROCHOBOT_LOG", '.')
|
||||||
|
|
||||||
|
logger = logging.getLogger('hrochobot')
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
|
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'))
|
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
@ -20,7 +24,7 @@ cogs_list = [
|
||||||
]
|
]
|
||||||
|
|
||||||
for cog in cogs_list:
|
for cog in cogs_list:
|
||||||
bot.load_extension(f'cogs.{cog}')
|
bot.load_extension(f'hrochobot.cogs.{cog}')
|
||||||
|
|
||||||
@bot.listen('on_interaction')
|
@bot.listen('on_interaction')
|
||||||
async def statistics(interaction):
|
async def statistics(interaction):
|
|
@ -1,6 +1,6 @@
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from utils.ksp_utils import *
|
from hrochobot.utils.ksp_utils import *
|
||||||
|
|
||||||
class Ksp(commands.Cog):
|
class Ksp(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
|
@ -1,5 +1,5 @@
|
||||||
import discord
|
import discord
|
||||||
import utils.data as data
|
import hrochobot.utils.data as data
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.utils import get
|
from discord.utils import get
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
DATA_FOLDER = "data"
|
DATA_FOLDER = "TODO"
|
||||||
|
|
||||||
def load_json(filename: str):
|
def load_json(filename: str):
|
||||||
with open(filename + ".json") as f:
|
with open(filename + ".json") as f:
|
19
setup.py
Normal file
19
setup.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
name='hrochbot',
|
||||||
|
version='1.0',
|
||||||
|
description='Discordový robot pro KSP',
|
||||||
|
packages=['hrochobot', 'hrochobot/cogs', 'hrochobot/utils'],
|
||||||
|
scripts=[
|
||||||
|
'bin/hrochobot',
|
||||||
|
],
|
||||||
|
include_package_data=True,
|
||||||
|
zip_safe=False,
|
||||||
|
install_requires=[
|
||||||
|
'py-cord',
|
||||||
|
'requests',
|
||||||
|
],
|
||||||
|
)
|
Loading…
Reference in a new issue