-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from ajstewart/release-v1.1.1
Release v1.1.1
- Loading branch information
Showing
24 changed files
with
2,893 additions
and
2,590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude: "README.md" | ||
- id: end-of-file-fixer | ||
- id: debug-statements | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# Ruff version. | ||
rev: "v0.0.270" | ||
hooks: | ||
- id: ruff | ||
|
||
- repo: https://github.com/python-poetry/poetry | ||
rev: "1.5.0" # add version here | ||
hooks: | ||
- id: poetry-check | ||
|
||
- repo: https://github.com/gitleaks/gitleaks | ||
rev: v8.16.3 | ||
hooks: | ||
- id: gitleaks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 14 additions & 12 deletions
26
alembic/versions/9b7158520f28_create_guild_schedule_settings_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
"""create guild_schedule_settings table | ||
"""create guild_schedule_settings table. | ||
Revision ID: 9b7158520f28 | ||
Revises: c897b93f45ce | ||
Create Date: 2022-08-26 22:35:28.930715 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '9b7158520f28' | ||
down_revision = 'c897b93f45ce' | ||
revision = "9b7158520f28" | ||
down_revision = "c897b93f45ce" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
"""Updgrade to 9b7158520f28 revision.""" | ||
op.create_table( | ||
'guild_schedule_settings', | ||
sa.Column('guild', sa.Integer, sa.ForeignKey("guilds.id"), nullable=False), | ||
sa.Column('base_open_message', sa.String(length=60), nullable=False), | ||
sa.Column('base_close_message', sa.String(length=60), nullable=False), | ||
sa.Column('warning_time', sa.Integer, nullable=False), | ||
sa.Column('inactive_time', sa.Integer, nullable=False), | ||
sa.Column('delay_time', sa.Integer, nullable=False), | ||
"guild_schedule_settings", | ||
sa.Column("guild", sa.Integer, sa.ForeignKey("guilds.id"), nullable=False), | ||
sa.Column("base_open_message", sa.String(length=60), nullable=False), | ||
sa.Column("base_close_message", sa.String(length=60), nullable=False), | ||
sa.Column("warning_time", sa.Integer, nullable=False), | ||
sa.Column("inactive_time", sa.Integer, nullable=False), | ||
sa.Column("delay_time", sa.Integer, nullable=False), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table('guild_schedule_settings') | ||
"""Downgrade to c897b93f45ce revision.""" | ||
op.drop_table("guild_schedule_settings") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,68 @@ | ||
"""Initial tables | ||
"""Initial tables. | ||
Revision ID: c897b93f45ce | ||
Revises: | ||
Create Date: 2022-06-04 20:11:35.416806 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'c897b93f45ce' | ||
revision = "c897b93f45ce" | ||
down_revision = None | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
"""Upgrade to c897b93f45ce revision.""" | ||
op.create_table( | ||
'guilds', | ||
sa.Column('id', sa.Integer, primary_key=True), | ||
sa.Column('tz', sa.String(length=40), nullable=False), | ||
sa.Column('admin_channel', sa.Integer, nullable=False), | ||
sa.Column('meowth_raid_category', sa.Integer, nullable=False), | ||
sa.Column('any_raids_filter', sa.Boolean, nullable=False), | ||
sa.Column('log_channel', sa.Integer, nullable=False), | ||
sa.Column('time_channel', sa.Integer, nullable=False), | ||
sa.Column('join_name_filter', sa.Boolean, nullable=False), | ||
sa.Column('active', sa.Boolean, nullable=False), | ||
sa.Column('prefix', sa.String(length=3), nullable=False) | ||
"guilds", | ||
sa.Column("id", sa.Integer, primary_key=True), | ||
sa.Column("tz", sa.String(length=40), nullable=False), | ||
sa.Column("admin_channel", sa.Integer, nullable=False), | ||
sa.Column("meowth_raid_category", sa.Integer, nullable=False), | ||
sa.Column("any_raids_filter", sa.Boolean, nullable=False), | ||
sa.Column("log_channel", sa.Integer, nullable=False), | ||
sa.Column("time_channel", sa.Integer, nullable=False), | ||
sa.Column("join_name_filter", sa.Boolean, nullable=False), | ||
sa.Column("active", sa.Boolean, nullable=False), | ||
sa.Column("prefix", sa.String(length=3), nullable=False), | ||
) | ||
|
||
op.create_table( | ||
'schedules', | ||
sa.Column('guild', sa.Integer, sa.ForeignKey("guilds.id"), nullable=False), | ||
sa.Column('channel', sa.Integer, nullable=False), | ||
sa.Column('role', sa.Integer, nullable=False), | ||
sa.Column('channel_name', sa.String(length=40), nullable=False), | ||
sa.Column('role_name', sa.String(length=30), nullable=False), | ||
sa.Column('open', sa.String(length=5), nullable=False), | ||
sa.Column('close', sa.String(length=5), nullable=False), | ||
sa.Column('open_message', sa.String(length=255), nullable=False), | ||
sa.Column('close_message', sa.String(length=255), nullable=False), | ||
sa.Column('warning', sa.Boolean, nullable=False), | ||
sa.Column('dynamic', sa.Boolean, nullable=False), | ||
sa.Column('dynamic_close', sa.String(length=5), nullable=False), | ||
sa.Column('max_num_delays', sa.Integer, nullable=False), | ||
sa.Column('current_delay_num', sa.Integer, nullable=False), | ||
sa.Column('silent', sa.Boolean, nullable=False), | ||
sa.Column('active', sa.Boolean, nullable=False) | ||
"schedules", | ||
sa.Column("guild", sa.Integer, sa.ForeignKey("guilds.id"), nullable=False), | ||
sa.Column("channel", sa.Integer, nullable=False), | ||
sa.Column("role", sa.Integer, nullable=False), | ||
sa.Column("channel_name", sa.String(length=40), nullable=False), | ||
sa.Column("role_name", sa.String(length=30), nullable=False), | ||
sa.Column("open", sa.String(length=5), nullable=False), | ||
sa.Column("close", sa.String(length=5), nullable=False), | ||
sa.Column("open_message", sa.String(length=255), nullable=False), | ||
sa.Column("close_message", sa.String(length=255), nullable=False), | ||
sa.Column("warning", sa.Boolean, nullable=False), | ||
sa.Column("dynamic", sa.Boolean, nullable=False), | ||
sa.Column("dynamic_close", sa.String(length=5), nullable=False), | ||
sa.Column("max_num_delays", sa.Integer, nullable=False), | ||
sa.Column("current_delay_num", sa.Integer, nullable=False), | ||
sa.Column("silent", sa.Boolean, nullable=False), | ||
sa.Column("active", sa.Boolean, nullable=False), | ||
) | ||
|
||
op.create_table( | ||
'fc_channels', | ||
sa.Column('guild', sa.Integer, sa.ForeignKey("guilds.id"), nullable=False), | ||
sa.Column('channel', sa.Integer, nullable=False), | ||
sa.Column('channel_name', sa.String(length=40), nullable=False), | ||
sa.Column('secret', sa.Boolean, nullable=False) | ||
"fc_channels", | ||
sa.Column("guild", sa.Integer, sa.ForeignKey("guilds.id"), nullable=False), | ||
sa.Column("channel", sa.Integer, nullable=False), | ||
sa.Column("channel_name", sa.String(length=40), nullable=False), | ||
sa.Column("secret", sa.Boolean, nullable=False), | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table('fc_channels') | ||
op.drop_table('schedules') | ||
op.drop_table('guilds') | ||
"""Downgrade to c897b93f45ce revision.""" | ||
op.drop_table("fc_channels") | ||
op.drop_table("schedules") | ||
op.drop_table("guilds") |
18 changes: 10 additions & 8 deletions
18
alembic/versions/f8574e25d62d_add_last_message_id_to_close_and_open.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
"""add last message id to close and open | ||
"""add last message id to close and open. | ||
Revision ID: f8574e25d62d | ||
Revises: 9b7158520f28 | ||
Create Date: 2022-09-25 16:52:26.857550 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'f8574e25d62d' | ||
down_revision = '9b7158520f28' | ||
revision = "f8574e25d62d" | ||
down_revision = "9b7158520f28" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
"""Upgrade to f8574e25d62d revision.""" | ||
with op.batch_alter_table("schedules") as batch_op: | ||
batch_op.add_column(sa.Column('last_open_message', sa.Integer)) | ||
batch_op.add_column(sa.Column('last_close_message', sa.Integer)) | ||
batch_op.add_column(sa.Column("last_open_message", sa.Integer)) | ||
batch_op.add_column(sa.Column("last_close_message", sa.Integer)) | ||
|
||
|
||
def downgrade() -> None: | ||
"""Downgrade to 9b7158520f28 revision.""" | ||
with op.batch_alter_table("schedules") as batch_op: | ||
batch_op.drop_column('last_open_message') | ||
batch_op.drop_column('last_close_message') | ||
batch_op.drop_column("last_open_message") | ||
batch_op.drop_column("last_close_message") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,69 @@ | ||
#!/usr/bin/env python | ||
"""Main bot file.""" | ||
import os | ||
|
||
import discord | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
from discord.ext import commands | ||
from dotenv import load_dotenv | ||
|
||
from cogs.utils.checks import check_admin | ||
from cogs.utils.utils import get_logger, get_prefix | ||
|
||
|
||
__version__ = '1.1.0' | ||
DOCS_URL = 'placeholder' | ||
__version__ = "1.1.1" | ||
DOCS_URL = "placeholder" | ||
|
||
|
||
class MyBot(commands.Bot): | ||
"""Bot class. | ||
""" | ||
"""Bot class.""" | ||
|
||
def __init__(self, command_prefix, intents, version, test_guild=None): | ||
super().__init__( | ||
command_prefix=command_prefix, | ||
intents=intents | ||
) | ||
"""Initialise the bot.""" | ||
super().__init__(command_prefix=command_prefix, intents=intents) | ||
self.initial_extensions = [ | ||
'cogs.initial', | ||
'cogs.admin', | ||
'cogs.any_raids_filter', | ||
'cogs.fc_filter', | ||
'cogs.join_name_filter', | ||
'cogs.misc', | ||
'cogs.time_channel', | ||
'cogs.schedules', | ||
"cogs.initial", | ||
"cogs.admin", | ||
"cogs.any_raids_filter", | ||
"cogs.fc_filter", | ||
"cogs.join_name_filter", | ||
"cogs.misc", | ||
"cogs.time_channel", | ||
"cogs.schedules", | ||
] | ||
self.help_command.add_check(check_admin) | ||
self.my_version = version | ||
self.test_guild = test_guild | ||
self.docs = DOCS_URL | ||
|
||
async def setup_hook(self): | ||
"""Load the initial extensions.""" | ||
for ext in self.initial_extensions: | ||
await self.load_extension(ext) | ||
|
||
async def on_ready(self): | ||
logger.info('Bot is ready!') | ||
"""Print a message to the console when the bot is ready.""" | ||
logger.info("Bot is ready!") | ||
|
||
|
||
# LOADS THE .ENV FILE THAT RESIDES ON THE SAME LEVEL AS THE SCRIPT. | ||
load_dotenv() | ||
|
||
# GRAB THE API TOKEN FROM THE .ENV FILE. | ||
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN') | ||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN") | ||
# Set the TEST_GUILD ID | ||
try: | ||
TEST_GUILD = int(os.getenv('TEST_GUILD')) | ||
TEST_GUILD = int(os.getenv("TEST_GUILD")) | ||
if len(str(TEST_GUILD)) < 17: | ||
raise ValueError(f"{TEST_GUILD} is not a valid guild ID!") | ||
except Exception as e: | ||
except Exception: | ||
TEST_GUILD = None | ||
|
||
intents = discord.Intents.default() | ||
intents.members = True | ||
intents.message_content = True | ||
|
||
logger = get_logger(logfile='snorlax.log') | ||
logger.info('Starting bot...') | ||
logger = get_logger(logfile="snorlax.log") | ||
logger.info("Starting bot...") | ||
|
||
bot = MyBot((get_prefix), intents, __version__, test_guild=TEST_GUILD) | ||
bot.run(DISCORD_TOKEN, log_handler=None) |
Oops, something went wrong.