Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypy autopin #974

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cogs/autopin/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, bot: commands.Bot):
self.check = room_check.RoomCheck(bot)
self.pin_features = AutopinFeatures(bot)

async def api(self, message: commands.Context, params: list):
async def api(self, message: commands.Context, params: dict):
"""Sending pins from channel to grillbot"""
if "command" in params and params["command"] is not None:
if params["command"] == "pin_get_all":
Expand Down Expand Up @@ -107,7 +107,7 @@ async def get_list(self, inter: disnake.ApplicationCommandInteraction):
message: disnake.Message = await channel.fetch_message(int(item.message_id))
msg: str = MessagesCZ.list_item(channel=channel.mention, url=message.jump_url)
except disnake.NotFound:
msg: str = MessagesCZ.list_unknown_message(channel=channel.mention)
msg = MessagesCZ.list_unknown_message(channel=channel.mention)
finally:
lines.append(msg)

Expand Down
6 changes: 4 additions & 2 deletions cogs/autopin/features.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import datetime
import io
import json
from typing import TypeAlias

import disnake
from disnake.ext import commands

import utils
from config.app_config import config

PIN_CHANNEL_TYPE = disnake.TextChannel | disnake.Thread
PIN_CHANNEL_TYPE: TypeAlias = disnake.TextChannel | disnake.Thread


class AutopinFeatures:
Expand All @@ -25,7 +27,7 @@ async def log(self, message: disnake.Message, users: list[disnake.User]):
name="Message in channel", value=f"[#{message.channel.name}]({message.jump_url})", inline=False
)
embed.timestamp = datetime.datetime.now(tz=datetime.timezone.utc)
channel = self.bot.get_channel(self.config.log_channel)
channel = self.bot.get_channel(config.log_channel)
await channel.send(embed=embed)

async def create_json_file(
Expand Down