diff --git a/alembic/versions/36300b558ef1_meme_templates.py b/alembic/versions/36300b558ef1_meme_templates.py deleted file mode 100644 index 275133a..0000000 --- a/alembic/versions/36300b558ef1_meme_templates.py +++ /dev/null @@ -1,37 +0,0 @@ -"""Meme templates - -Revision ID: 36300b558ef1 -Revises: 08d21b2d1a0a -Create Date: 2022-08-25 01:34:22.845955 - -""" -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "36300b558ef1" -down_revision = "08d21b2d1a0a" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "meme", - sa.Column("meme_id", sa.Integer(), nullable=False), - sa.Column("name", sa.Text(), nullable=False), - sa.Column("template_id", sa.Integer(), nullable=False), - sa.Column("field_count", sa.Integer(), nullable=False), - sa.PrimaryKeyConstraint("meme_id"), - sa.UniqueConstraint("name"), - sa.UniqueConstraint("template_id"), - ) - # ### end Alembic commands ### - - -def downgrade() -> None: - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("meme") - # ### end Alembic commands ### diff --git a/database/crud/memes.py b/database/crud/memes.py deleted file mode 100644 index f92f6ef..0000000 --- a/database/crud/memes.py +++ /dev/null @@ -1,35 +0,0 @@ -from typing import Optional - -from sqlalchemy import select -from sqlalchemy.exc import IntegrityError -from sqlalchemy.ext.asyncio import AsyncSession - -from database.schemas.relational import MemeTemplate - -__all__ = ["add_meme", "get_all_memes", "get_meme_by_name"] - - -async def add_meme(session: AsyncSession, name: str, template_id: int, field_count: int) -> Optional[MemeTemplate]: - """Add a new meme into the database""" - try: - meme = MemeTemplate(name=name, template_id=template_id, field_count=field_count) - session.add(meme) - await session.commit() - return meme - except IntegrityError: - return None - - -async def get_all_memes(session: AsyncSession) -> list[MemeTemplate]: - """Get a list of all memes""" - statement = select(MemeTemplate) - return (await session.execute(statement)).scalars().all() - - -async def get_meme_by_name(session: AsyncSession, query: str) -> Optional[MemeTemplate]: - """Try to find a meme by its name - - Returns the first match found by PSQL - """ - statement = select(MemeTemplate).where(MemeTemplate.name.ilike(f"%{query.lower()}%")) - return (await session.execute(statement)).scalar() diff --git a/database/schemas/relational.py b/database/schemas/relational.py index 904459e..6fd27d0 100644 --- a/database/schemas/relational.py +++ b/database/schemas/relational.py @@ -30,7 +30,6 @@ __all__ = [ "DadJoke", "Deadline", "Link", - "MemeTemplate", "NightlyData", "Task", "UforaAnnouncement", @@ -135,17 +134,6 @@ class Link(Base): url: str = Column(Text, nullable=False) -class MemeTemplate(Base): - """A meme template for the Imgflip API""" - - __tablename__ = "meme" - - meme_id: int = Column(Integer, primary_key=True) - name: str = Column(Text, nullable=False, unique=True) - template_id: int = Column(Integer, nullable=False, unique=True) - field_count: int = Column(Integer, nullable=False) - - class NightlyData(Base): """Data for a user's Nightly stats""" diff --git a/database/utils/caches.py b/database/utils/caches.py index ba26ab2..4f34419 100644 --- a/database/utils/caches.py +++ b/database/utils/caches.py @@ -5,7 +5,7 @@ from discord import app_commands from overrides import overrides from sqlalchemy.ext.asyncio import AsyncSession -from database.crud import links, memes, ufora_courses, wordle +from database.crud import links, ufora_courses, wordle from database.mongo_types import MongoDatabase __all__ = ["CacheManager", "LinkCache", "UforaCourseCache"] @@ -61,19 +61,6 @@ class LinkCache(DatabaseCache[AsyncSession]): self.data_transformed = list(map(str.lower, self.data)) -class MemeCache(DatabaseCache[AsyncSession]): - """Cache to store the names of meme templates""" - - @overrides - async def invalidate(self, database_session: AsyncSession): - self.clear() - - all_memes = await memes.get_all_memes(database_session) - self.data = list(map(lambda m: m.name, all_memes)) - self.data.sort() - self.data_transformed = list(map(str.lower, self.data)) - - class UforaCourseCache(DatabaseCache[AsyncSession]): """Cache to store the names of Ufora courses""" @@ -132,19 +119,16 @@ class CacheManager: """Class that keeps track of all caches""" links: LinkCache - memes: MemeCache ufora_courses: UforaCourseCache wordle_word: WordleCache def __init__(self): self.links = LinkCache() - self.memes = MemeCache() self.ufora_courses = UforaCourseCache() self.wordle_word = WordleCache() async def initialize_caches(self, postgres_session: AsyncSession, mongo_db: MongoDatabase): """Initialize the contents of all caches""" await self.links.invalidate(postgres_session) - await self.memes.invalidate(postgres_session) await self.ufora_courses.invalidate(postgres_session) await self.wordle_word.invalidate(mongo_db) diff --git a/didier/cogs/currency.py b/didier/cogs/currency.py index 05446f0..1b3dea5 100644 --- a/didier/cogs/currency.py +++ b/didier/cogs/currency.py @@ -46,12 +46,12 @@ class Currency(commands.Cog): bank = await crud.get_bank(session, ctx.author.id) embed = discord.Embed(colour=discord.Colour.blue()) - embed.set_author(name=f"{ctx.author.display_name}'s Bank") + embed.set_author(name=f"Bank van {ctx.author.display_name}") embed.set_thumbnail(url=ctx.author.avatar.url) embed.add_field(name="Interest level", value=bank.interest_level) - embed.add_field(name="Capacity level", value=bank.capacity_level) - embed.add_field(name="Currently invested", value=bank.invested, inline=False) + embed.add_field(name="Capaciteit level", value=bank.capacity_level) + embed.add_field(name="Momenteel geïnvesteerd", value=bank.invested, inline=False) await ctx.reply(embed=embed, mention_author=False) @@ -68,11 +68,11 @@ class Currency(commands.Cog): name=f"Interest ({bank.interest_level})", value=str(interest_upgrade_price(bank.interest_level)) ) embed.add_field( - name=f"Capacity ({bank.capacity_level})", value=str(capacity_upgrade_price(bank.capacity_level)) + name=f"Capaciteit ({bank.capacity_level})", value=str(capacity_upgrade_price(bank.capacity_level)) ) embed.add_field(name=f"Rob ({bank.rob_level})", value=str(rob_upgrade_price(bank.rob_level))) - embed.set_footer(text="Didier Bank Upgrade [Category]") + embed.set_footer(text="Didier Bank Upgrade [Categorie]") await ctx.reply(embed=embed, mention_author=False) @@ -84,7 +84,7 @@ class Currency(commands.Cog): await crud.upgrade_capacity(session, ctx.author.id) await ctx.message.add_reaction("⏫") except NotEnoughDinks: - await ctx.reply("You don't have enough Didier Dinks to do this.", mention_author=False) + await ctx.reply("Je hebt niet genoeg Didier Dinks om dit te doen.", mention_author=False) await self.client.reject_message(ctx.message) @bank_upgrades.command(name="Interest", aliases=["I"]) @@ -95,7 +95,7 @@ class Currency(commands.Cog): await crud.upgrade_interest(session, ctx.author.id) await ctx.message.add_reaction("⏫") except NotEnoughDinks: - await ctx.reply("You don't have enough Didier Dinks to do this.", mention_author=False) + await ctx.reply("Je hebt niet genoeg Didier Dinks om dit te doen.", mention_author=False) await self.client.reject_message(ctx.message) @bank_upgrades.command(name="Rob", aliases=["R"]) @@ -106,7 +106,7 @@ class Currency(commands.Cog): await crud.upgrade_rob(session, ctx.author.id) await ctx.message.add_reaction("⏫") except NotEnoughDinks: - await ctx.reply("You don't have enough Didier Dinks to do this.", mention_author=False) + await ctx.reply("Je hebt niet genoeg Didier Dinks om dit te doen.", mention_author=False) await self.client.reject_message(ctx.message) @commands.hybrid_command(name="dinks") @@ -115,7 +115,7 @@ class Currency(commands.Cog): async with self.client.postgres_session as session: bank = await crud.get_bank(session, ctx.author.id) plural = pluralize("Didier Dink", bank.dinks) - await ctx.reply(f"**{ctx.author.display_name}** has **{bank.dinks}** {plural}.", mention_author=False) + await ctx.reply(f"**{ctx.author.display_name}** heeft **{bank.dinks}** {plural}.", mention_author=False) @commands.command(name="Invest", aliases=["Deposit", "Dep"]) async def invest(self, ctx: commands.Context, amount: abbreviated_number): # type: ignore @@ -127,10 +127,10 @@ class Currency(commands.Cog): plural = pluralize("Didier Dink", invested) if invested == 0: - await ctx.reply("You don't have any Didier Dinks to invest.", mention_author=False) + await ctx.reply("Je hebt geen Didier Dinks om te investeren.", mention_author=False) else: await ctx.reply( - f"**{ctx.author.display_name}** has invested **{invested}** {plural}.", mention_author=False + f"**{ctx.author.display_name}** heeft **{invested}** {plural} geïnvesteerd.", mention_author=False ) @commands.hybrid_command(name="nightly") @@ -139,11 +139,9 @@ class Currency(commands.Cog): async with self.client.postgres_session as session: try: await crud.claim_nightly(session, ctx.author.id) - await ctx.reply(f"You've claimed your daily **{crud.NIGHTLY_AMOUNT}** Didier Dinks.") + await ctx.reply(f"Je hebt je dagelijkse **{crud.NIGHTLY_AMOUNT}** Didier Dinks geclaimd.") except DoubleNightly: - await ctx.reply( - "You've already claimed your Didier Nightly today.", mention_author=False, ephemeral=True - ) + await ctx.reply("Je hebt je nightly al geclaimd vandaag.", mention_author=False, ephemeral=True) async def setup(client: Didier): diff --git a/didier/cogs/fun.py b/didier/cogs/fun.py index d604b36..0aade01 100644 --- a/didier/cogs/fun.py +++ b/didier/cogs/fun.py @@ -1,15 +1,7 @@ -import shlex - -import discord -from discord import app_commands from discord.ext import commands from database.crud.dad_jokes import get_random_dad_joke -from database.crud.memes import get_meme_by_name from didier import Didier -from didier.data.apis.imgflip import generate_meme -from didier.exceptions.no_match import expect -from didier.views.modals import GenerateMeme class Fun(commands.Cog): @@ -17,18 +9,9 @@ class Fun(commands.Cog): client: Didier - # Slash groups - memes_slash = app_commands.Group(name="meme", description="Commands to generate memes", guild_only=False) - def __init__(self, client: Didier): self.client = client - async def _do_generate_meme(self, meme_name: str, fields: list[str]) -> str: - async with self.client.postgres_session as session: - result = expect(await get_meme_by_name(session, meme_name), entity_type="meme", argument=meme_name) - meme = await generate_meme(self.client.http_session, result, fields) - return meme - @commands.hybrid_command( name="dadjoke", aliases=["Dad", "Dj"], @@ -40,50 +23,6 @@ class Fun(commands.Cog): joke = await get_random_dad_joke(session) return await ctx.reply(joke.joke, mention_author=False) - @commands.group(name="Memegen", aliases=["Meme", "Memes"], invoke_without_command=True, case_insensitive=True) - async def memegen_msg(self, ctx: commands.Context, meme_name: str, *, fields: str): - """Command group for meme-related commands""" - async with ctx.typing(): - meme = await self._do_generate_meme(meme_name, shlex.split(fields)) - return await ctx.reply(meme, mention_author=False) - - @memegen_msg.command(name="Preview", aliases=["P"]) - async def memegen_preview_msg(self, ctx: commands.Context, meme_name: str): - """Generate a preview for a meme, to see how the fields are structured""" - async with ctx.typing(): - fields = [f"Field #{i + 1}" for i in range(20)] - meme = await self._do_generate_meme(meme_name, fields) - return await ctx.reply(meme, mention_author=False) - - @memes_slash.command(name="generate", description="Generate a meme") - async def memegen_slash(self, interaction: discord.Interaction, meme: str): - """Slash command to generate a meme""" - async with self.client.postgres_session as session: - result = expect(await get_meme_by_name(session, meme), entity_type="meme", argument=meme) - - modal = GenerateMeme(self.client, result) - await interaction.response.send_modal(modal) - - @memes_slash.command( - name="preview", description="Generate a preview for a meme, to see how the fields are structured" - ) - async def memegen_preview_slash(self, interaction: discord.Interaction, meme: str): - """Slash command to generate a meme preview""" - await interaction.response.defer() - - fields = [f"Field #{i + 1}" for i in range(20)] - meme_url = await self._do_generate_meme(meme, fields) - - await interaction.followup.send(meme_url, ephemeral=True) - - @memegen_slash.autocomplete("meme") - @memegen_preview_slash.autocomplete("meme") - async def _memegen_slash_autocomplete_meme( - self, _: discord.Interaction, current: str - ) -> list[app_commands.Choice[str]]: - """Autocompletion for the 'meme'-parameter""" - return self.client.database_caches.memes.get_autocomplete_suggestions(current) - async def setup(client: Didier): """Load the cog""" diff --git a/didier/cogs/owner.py b/didier/cogs/owner.py index 2fa4b4e..d030344 100644 --- a/didier/cogs/owner.py +++ b/didier/cogs/owner.py @@ -5,7 +5,7 @@ from discord import app_commands from discord.ext import commands import settings -from database.crud import custom_commands, links, memes, ufora_courses +from database.crud import custom_commands, links, ufora_courses from database.exceptions.constraints import DuplicateInsertException from database.exceptions.not_found import NoResultFoundException from didier import Didier @@ -167,19 +167,6 @@ class Owner(commands.Cog): modal = AddLink(self.client) await interaction.response.send_modal(modal) - @add_slash.command(name="meme", description="Add a new meme") - async def add_meme_slash(self, interaction: discord.Interaction, name: str, imgflip_id: int, field_count: int): - """Slash command to add new memes""" - await interaction.response.defer(ephemeral=True) - - async with self.client.postgres_session as session: - meme = await memes.add_meme(session, name, imgflip_id, field_count) - if meme is None: - return await interaction.followup.send("A meme with this name (or id) already exists.") - - await interaction.followup.send(f"Added meme `{meme.meme_id}`.") - await self.client.database_caches.memes.invalidate(session) - @commands.group(name="Edit", case_insensitive=True, invoke_without_command=False) async def edit_msg(self, ctx: commands.Context): """Command group for [edit X] commands""" diff --git a/didier/data/apis/imgflip.py b/didier/data/apis/imgflip.py deleted file mode 100644 index b373897..0000000 --- a/didier/data/apis/imgflip.py +++ /dev/null @@ -1,39 +0,0 @@ -from aiohttp import ClientSession - -import settings -from database.schemas.relational import MemeTemplate -from didier.exceptions.missing_env import MissingEnvironmentVariable -from didier.utils.http.requests import ensure_post - -__all__ = ["generate_meme"] - - -def generate_boxes(meme: MemeTemplate, fields: list[str]) -> list[str]: - """Generate the template boxes for Imgflip""" - # If a meme only has 1 field, join all the arguments together into one string - if meme.field_count == 1: - fields = [" ".join(fields)] - - fields = fields[: min(20, meme.field_count)] - # TODO manipulate the text if necessary - return fields - - -async def generate_meme(http_session: ClientSession, meme: MemeTemplate, fields: list[str]) -> str: - """Make a request to Imgflip to generate a meme""" - name, password = settings.IMGFLIP_NAME, settings.IMGFLIP_PASSWORD - - # Ensure credentials exist - if name is None: - raise MissingEnvironmentVariable("IMGFLIP_NAME") - - if password is None: - raise MissingEnvironmentVariable("IMGFLIP_PASSWORD") - - boxes = generate_boxes(meme, fields) - payload = {"template_id": meme.template_id, "username": name, "password": password} - for i, box in enumerate(boxes): - payload[f"boxes[{i}][text]"] = box - - async with ensure_post(http_session, "https://api.imgflip.com/caption_image", payload=payload) as response: - return response["data"]["url"] diff --git a/didier/didier.py b/didier/didier.py index 337b342..3217b61 100644 --- a/didier/didier.py +++ b/didier/didier.py @@ -4,7 +4,6 @@ import os import discord import motor.motor_asyncio from aiohttp import ClientSession -from discord.app_commands import AppCommandError from discord.ext import commands from sqlalchemy.ext.asyncio import AsyncSession @@ -13,7 +12,6 @@ from database.crud import custom_commands from database.engine import DBSession, mongo_client from database.utils.caches import CacheManager from didier.data.embeds.error_embed import create_error_embed -from didier.exceptions import HTTPException, NoMatch from didier.utils.discord.prefix import get_prefix __all__ = ["Didier"] @@ -48,8 +46,6 @@ class Didier(commands.Bot): command_prefix=get_prefix, case_insensitive=True, intents=intents, activity=activity, status=status ) - self.tree.on_error = self.on_app_command_error - @property def postgres_session(self) -> AsyncSession: """Obtain a session for the PostgreSQL database""" @@ -201,18 +197,6 @@ class Didier(commands.Bot): """Event triggered when a new thread is created""" await thread.join() - async def on_app_command_error(self, interaction: discord.Interaction, exception: AppCommandError): - """Event triggered when an application command errors""" - # If commands have their own error handler, let it handle the error instead - if hasattr(interaction.command, "on_error"): - return - - if isinstance(exception, (NoMatch, discord.app_commands.CommandInvokeError)): - if interaction.response.is_done(): - return await interaction.response.send_message(str(exception.original), ephemeral=True) - else: - return await interaction.followup.send(str(exception.original), ephemeral=True) - async def on_command_error(self, ctx: commands.Context, exception: commands.CommandError, /): """Event triggered when a regular command errors""" # If working locally, print everything to your console @@ -235,16 +219,6 @@ class Didier(commands.Bot): ): return - # Responses to things that go wrong during processing of commands - if isinstance(exception, commands.CommandInvokeError) and isinstance( - exception.original, - ( - NoMatch, - HTTPException, - ), - ): - return await ctx.reply(str(exception.original), mention_author=False) - # Print everything that we care about to the logs/stderr await super().on_command_error(ctx, exception) diff --git a/didier/exceptions/__init__.py b/didier/exceptions/__init__.py index 4321cae..e69de29 100644 --- a/didier/exceptions/__init__.py +++ b/didier/exceptions/__init__.py @@ -1,5 +0,0 @@ -from .http_exception import HTTPException -from .missing_env import MissingEnvironmentVariable -from .no_match import NoMatch, expect - -__all__ = ["HTTPException", "MissingEnvironmentVariable", "NoMatch", "expect"] diff --git a/didier/exceptions/http_exception.py b/didier/exceptions/http_exception.py deleted file mode 100644 index c4e9f2c..0000000 --- a/didier/exceptions/http_exception.py +++ /dev/null @@ -1,8 +0,0 @@ -__all__ = ["HTTPException"] - - -class HTTPException(RuntimeError): - """Error raised when an API call fails""" - - def __init__(self, status_code: int): - super().__init__(f"Something went wrong (status {status_code}).") diff --git a/didier/exceptions/missing_env.py b/didier/exceptions/missing_env.py deleted file mode 100644 index 863a092..0000000 --- a/didier/exceptions/missing_env.py +++ /dev/null @@ -1,8 +0,0 @@ -__all__ = ["MissingEnvironmentVariable"] - - -class MissingEnvironmentVariable(RuntimeError): - """Exception raised when an environment variable is missing""" - - def __init__(self, variable_name): - super().__init__(f"Missing environment variable: {variable_name}") diff --git a/didier/exceptions/no_match.py b/didier/exceptions/no_match.py deleted file mode 100644 index fed1a6d..0000000 --- a/didier/exceptions/no_match.py +++ /dev/null @@ -1,24 +0,0 @@ -from typing import Optional, TypeVar - -__all__ = ["NoMatch", "expect"] - - -class NoMatch(ValueError): - """Error raised when a database lookup failed""" - - def __init__(self, entity_type: str, argument: str): - super().__init__(f"Found no {entity_type} matching `{argument}`.") - - -T = TypeVar("T") - - -def expect(instance: Optional[T], *, entity_type: str, argument: str) -> T: - """Mark a database instance as expected, otherwise raise a custom exception - - This is not just done in the database layer because it's not always preferable - """ - if instance is None: - raise NoMatch(entity_type, argument) - - return instance diff --git a/didier/utils/http/__init__.py b/didier/utils/http/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/didier/utils/http/requests.py b/didier/utils/http/requests.py deleted file mode 100644 index f649701..0000000 --- a/didier/utils/http/requests.py +++ /dev/null @@ -1,56 +0,0 @@ -import logging -from contextlib import asynccontextmanager -from typing import AsyncGenerator - -from aiohttp import ClientResponse, ClientSession - -from didier.exceptions.http_exception import HTTPException - -logger = logging.getLogger(__name__) - - -__all__ = ["ensure_get", "ensure_post"] - - -def request_successful(response: ClientResponse) -> bool: - """Check if a request was successful or not""" - return 200 <= response.status < 300 - - -@asynccontextmanager -async def ensure_get(http_session: ClientSession, endpoint: str) -> AsyncGenerator[dict, None]: - """Context manager that automatically raises an exception if a GET-request fails""" - async with http_session.get(endpoint) as response: - if not request_successful(response): - logger.error( - "Failed HTTP request to %s (status %s)\nResponse: %s", endpoint, response.status, await response.json() - ) - - raise HTTPException(response.status) - - yield await response.json() - - -@asynccontextmanager -async def ensure_post( - http_session: ClientSession, endpoint: str, payload: dict, *, expect_return: bool = True -) -> AsyncGenerator[dict, None]: - """Context manager that automatically raises an exception if a POST-request fails""" - async with http_session.post(endpoint, data=payload) as response: - if not request_successful(response): - logger.error( - "Failed HTTP request to %s (status %s)\nPayload: %s\nResponse: %s", - endpoint, - response.status, - payload, - await response.json(), - ) - - raise HTTPException(response.status) - - if expect_return: - yield await response.json() - else: - # Always return A dict so you can always "use" the result without having to check - # if it is None or not - yield {} diff --git a/didier/views/modals/__init__.py b/didier/views/modals/__init__.py index 62d700f..42c2ce8 100644 --- a/didier/views/modals/__init__.py +++ b/didier/views/modals/__init__.py @@ -2,6 +2,5 @@ from .custom_commands import CreateCustomCommand, EditCustomCommand from .dad_jokes import AddDadJoke from .deadlines import AddDeadline from .links import AddLink -from .memes import GenerateMeme -__all__ = ["AddDadJoke", "AddDeadline", "CreateCustomCommand", "EditCustomCommand", "AddLink", "GenerateMeme"] +__all__ = ["AddDadJoke", "AddDeadline", "CreateCustomCommand", "EditCustomCommand", "AddLink"] diff --git a/didier/views/modals/memes.py b/didier/views/modals/memes.py deleted file mode 100644 index c98e17f..0000000 --- a/didier/views/modals/memes.py +++ /dev/null @@ -1,46 +0,0 @@ -import traceback - -import discord.ui -from overrides import overrides - -from database.schemas.relational import MemeTemplate -from didier import Didier -from didier.data.apis.imgflip import generate_meme - -__all__ = ["GenerateMeme"] - - -class GenerateMeme(discord.ui.Modal, title="Generate Meme"): - """Modal to generate a meme""" - - client: Didier - meme: MemeTemplate - - def __init__(self, client: Didier, meme: MemeTemplate, *args, **kwargs): - super().__init__(*args, **kwargs) - self.client = client - self.meme = meme - - for i in range(meme.field_count): - self.add_item( - discord.ui.TextInput( - label=f"Field #{i + 1}", - placeholder="Here be funny text", - style=discord.TextStyle.long, - required=True, - ) - ) - - @overrides - async def on_submit(self, interaction: discord.Interaction): - await interaction.response.defer() - - fields = [item.value for item in self.children if isinstance(item, discord.ui.TextInput)] - - meme_url = await generate_meme(self.client.http_session, self.meme, fields) - await interaction.followup.send(meme_url) - - @overrides - async def on_error(self, interaction: discord.Interaction, error: Exception): # type: ignore - traceback.print_tb(error.__traceback__) - await interaction.followup.send("Something went wrong.", ephemeral=True) diff --git a/main.py b/main.py index f791621..fdbc027 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ def setup_logging(): max_log_size = 32 * 1024 * 1024 # Configure Didier handler - didier_log = logging.getLogger(__name__) + didier_log = logging.getLogger("didier") didier_handler = RotatingFileHandler(settings.LOGFILE, mode="a", maxBytes=max_log_size, backupCount=5) didier_handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s]: %(message)s")) diff --git a/settings.py b/settings.py index a041397..ec6039c 100644 --- a/settings.py +++ b/settings.py @@ -24,8 +24,6 @@ __all__ = [ "UFORA_ANNOUNCEMENTS_CHANNEL", "UFORA_RSS_TOKEN", "URBAN_DICTIONARY_TOKEN", - "IMGFLIP_NAME", - "IMGFLIP_PASSWORD", ] @@ -66,5 +64,3 @@ UFORA_ANNOUNCEMENTS_CHANNEL: Optional[int] = env.int("UFORA_ANNOUNCEMENTS_CHANNE """API Keys""" UFORA_RSS_TOKEN: Optional[str] = env.str("UFORA_RSS_TOKEN", None) URBAN_DICTIONARY_TOKEN: Optional[str] = env.str("URBAN_DICTIONARY_TOKEN", None) -IMGFLIP_NAME: Optional[str] = env.str("IMGFLIP_NAME", None) -IMGFLIP_PASSWORD: Optional[str] = env.str("IMGFLIP_PASSWORD", None)