Пример #1
0
from discord.ext import commands
import asyncio

# Other utilities
import os, sys

# Parse config file
from config import parser

# Utility for auto-add
from db import db_utilities as db

#Extension List
startup = ["osu", "update"]

config = parser.Parser()
utility = db.Db_Utilities(config.db_path, config.osukey)

bot = commands.Bot(command_prefix='!')


@bot.event
@asyncio.coroutine
def on_ready():
    print('Logged in as {} ({})'.format(bot.user.name, bot.user.id))


@bot.command()
@commands.has_any_role(*config.modroles)
@asyncio.coroutine
def load(extension_name: str):
Пример #2
0
 def __init__(self, bot):
     self.bot = bot
     self.config = parser.Parser()
     self.utility = disc_utilities.Disc_Utilities()
Пример #3
0
#
# You should have received a copy of the GNU General Public License
# along with Canary. If not, see <https://www.gnu.org/licenses/>.

from discord.ext import commands

from config import parser
import logging
import sqlite3
import traceback
import requests
from discord import Webhook, RequestsWebhookAdapter, Intents

__all__ = ["bot", "developer_role", "moderator_role"]

_parser = parser.Parser()
command_prefix = _parser.command_prefix

# Create parent logger, which will send all logs from the "sub-loggers"
# to the specified log file
_logger = logging.getLogger("Canary")
_logger.setLevel(_parser.log_level)
_file_handler = logging.FileHandler(filename=_parser.log_file, encoding="utf-8", mode="a")
_file_handler.setFormatter(logging.Formatter("[%(levelname)s] %(asctime)s: %(message)s"))
_logger.addHandler(_file_handler)

# Create dev (sub-)logger, which is where errors and messages are logged
# If a dev webhook is specified, logs sent to the dev logger will be
# sent to the webhook
_dev_logger = logging.getLogger("Canary.Dev")
_dev_logger.setLevel(_parser.log_level)