コード例 #1
0
    def __init__(self, bot):
        self.bot = bot
        self.cancel_all = False
        self.cancel_draws = []
        self.pause_draws = False
        self.progress = {}
        self.image = None
        self.queue = []
        self.background_draw.start()
        self.db_path = "./data/discord.db"
        self.place_path = "./place/"
        self.conn = SQLFunctions.connect()

        self.LINE_HEIGHT = 62  # amount of lines which fit on the place canvas
        self.CHAR_WIDTH = 166  # amount of chars which fit in a line on the place canvas
        self.font = ImageFont.truetype("./data/nk57-monospace-cd-rg.ttf", 12)
        self.userToCopyTextFrom = -1
        self.last_line = SQLFunctions.get_config("Draw_Last_Line", self.conn)
        if len(self.last_line) == 0:
            self.last_line = 0
        else:
            self.last_line = self.last_line[0]
        self.last_char = SQLFunctions.get_config("Draw_Last_Char", self.conn)
        if len(self.last_char) == 0:
            self.last_char = 0
        else:
            self.last_char = self.last_char[0]
コード例 #2
0
ファイル: updates.py プロジェクト: markbeep/Lecturfier
 def __init__(self, bot):
     self.bot = bot
     self.send_message_to_finn = False
     self.lecture_updater_version = "v1.0"
     self.db_path = "./data/discord.db"
     self.conn = SQLFunctions.connect()
     self.channel_to_post = SQLFunctions.get_config(
         "channel_to_post_updates", self.conn)
     self.background_loop.start()
     self.current_activity = ""
     self.sent_updates = {
         1: False,
         2: False,
         3: False,
         4: False,
         5: False,
         6: False
     }
     self.lecture_updates_role_ids = {
         "first": 885810281358446623,
         "second": 885810349121622056,
         "third": 885810401969831978
     }
     self.sent_advent = False
     self.sent_website_updates = False
コード例 #3
0
 def __init__(self, bot):
     self.bot = bot
     with open("./data/ignored_users.json") as f:
         self.ignored_users = json.load(f)
     self.db_path = "./data/discord.db"
     self.conn = SQLFunctions.connect()
     self.time_to_wait = 20 * 3600  # Wait 20 hours before repping again
コード例 #4
0
 def __init__(self, bot):
     self.bot = bot
     self.script_start = 0
     self.waiting = False
     self.time_counter = 0  # So statistics dont get saved every few seconds, and instead only every 2 mins
     self.bot_changed_to_yesterday = {}
     self.background_git_backup.start()
     self.sent_file = False
     self.current_subject = [-1, 0]
     self.conn = SQLFunctions.connect()
コード例 #5
0
ファイル: owner.py プロジェクト: markbeep/Lecturfier
    def __init__(self, bot):
        self.bot = bot
        self.db_path = "./data/discord.db"
        self.conn = SQLFunctions.connect()

        # gets the button value to watch
        self.watch_button_value = SQLFunctions.get_config("ButtonValue", self.conn)
        if len(self.watch_button_value) == 0:
            self.watch_button_value = 1e6
        else:
            self.watch_button_value = self.watch_button_value[0]
        self.sent_message = False
        self.old_value = 1e6  # to ignore fake buttons we store the last value
コード例 #6
0
 def __init__(self, bot):
     self.bot = bot
     self.newcomers = {}
     self.ta_request = {}
     self.bot_prefix_path = "./data/bot_prefix.json"
     with open(self.bot_prefix_path, "r") as f:
         self.all_prefix = json.load(f)
     self.db_path = "./data/discord.db"
     self.conn = SQLFunctions.connect()
     self.welcome_message_id = SQLFunctions.get_config(
         "WelcomeMessage", self.conn)
     self.requested_help = [
     ]  # list of DiscordUserIDs of who requested help
     self.requested_ta = [
     ]  # list of DiscordUserIDs which requested TA role to avoid spam
コード例 #7
0
ファイル: games.py プロジェクト: markbeep/Lecturfier
 def __init__(self, bot):
     self.bot = bot
     self.clap_counter = 0
     self.time = 0
     self.confirmed_cases = 0
     self.confirm_msg = None  # Confirmed message
     self.conn = SQLFunctions.connect()
     self.time_since_task_start = time.time()
     self.background_check_cases.start()
     self.sent_covid = False
     recent_covid_cases = SQLFunctions.get_config("COVID_Cases", self.conn)
     recent_covid_day = SQLFunctions.get_config("COVID_Day", self.conn)
     if len(recent_covid_cases) > 0:
         self.cases_today = recent_covid_cases[0]
     else:
         self.cases_today = 0
     if len(recent_covid_day) > 0:
         self.last_cases_day = recent_covid_day[0]
     else:
         self.last_cases_day = 0
コード例 #8
0
intents = discord.Intents()
bot = commands.Bot(
    command_prefix=prefix["prefix"],
    description='Lecture Notifier',
    intents=intents.all(),
    owner_id=205704051856244736)

# Loads the sub_bot cog, which can then easily be reloaded
bot.load_extension("cogs.mainbot")
# Loads the help page, as it has an on_ready event that needs to be called
bot.load_extension("cogs.help")
# enables discord components
DiscordComponents(bot)
# connects to the db
conn = SQLFunctions.connect()


@bot.event
async def on_message(message):
    await bot.process_commands(message)


@bot.check
async def globally_handle_permissions(ctx):
    """
    Checks if the command can be used in the channel. It's a blacklist system, so by default all commands
    can be used. Hierarchy is USER > ROLE > CHANNEL > GUILD.
    0 is the default value
    1 is allowed
    -1 is not allowed
コード例 #9
0
ファイル: voice.py プロジェクト: markbeep/Lecturfier
 def __init__(self, bot):
     self.bot = bot
     self.conn = SQLFunctions.connect()
     self.background_save_levels.start()