add /kiedy-ios command
This commit is contained in:
parent
4737a47ebe
commit
8b6ae0eea6
4 changed files with 8 additions and 38 deletions
|
@ -1,4 +1,5 @@
|
|||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
from .. import bot
|
||||
|
@ -45,7 +46,7 @@ def is_ios_request(text: str, /) -> bool:
|
|||
# the text is longer and doesn't look like just a simple question
|
||||
return False
|
||||
|
||||
words = set(text.replace("?", "").replace("!", "").casefold().split())
|
||||
words = text.replace("?", "").replace("!", "").casefold().split()
|
||||
|
||||
if all(word not in words for word in ("ios", "iphone", "apple")):
|
||||
return False
|
||||
|
@ -64,6 +65,11 @@ class Automod(commands.Cog):
|
|||
reply = await message.reply(embed=IOS_NOTICE, view=view)
|
||||
view.message = reply
|
||||
|
||||
@app_commands.command(name="kiedy-ios")
|
||||
async def kiedy_ios(self, interaction: discord.Interaction):
|
||||
"""Tłumaczy powody braku wersji na iOS"""
|
||||
await interaction.response.send_message(embed=IOS_NOTICE)
|
||||
|
||||
|
||||
async def setup(bot: bot.Wulkabot):
|
||||
await bot.add_cog(Automod())
|
||||
|
|
|
@ -188,7 +188,6 @@ class GitHub(commands.Cog):
|
|||
view = DeleteButton(message.author)
|
||||
reply = await message.reply(embeds=embeds[:3], view=view)
|
||||
view.message = reply
|
||||
print(reply.embeds)
|
||||
|
||||
|
||||
async def setup(bot: bot.Wulkabot):
|
||||
|
|
|
@ -5,9 +5,7 @@ import aiohttp
|
|||
|
||||
class GitHub:
|
||||
def __init__(self) -> None:
|
||||
self._http = aiohttp.ClientSession(
|
||||
base_url="https://api.github.com", headers={"Accept": "application/vnd.github.v3+json"}
|
||||
)
|
||||
self._http = aiohttp.ClientSession(base_url="https://api.github.com")
|
||||
|
||||
async def fetch_repo(self, owner: str, repo: str) -> dict[str, Any]:
|
||||
response = await self._http.get(f"/repos/{owner}/{repo}")
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
POLISH_DIACRITICS = {
|
||||
"Ą": "A",
|
||||
"Ć": "C",
|
||||
"Ę": "E",
|
||||
"Ł": "L",
|
||||
"Ń": "N",
|
||||
"Ó": "O",
|
||||
"Ś": "S",
|
||||
"Ź": "Z",
|
||||
"Ż": "Z",
|
||||
"ą": "a",
|
||||
"ć": "c",
|
||||
"ę": "e",
|
||||
"ł": "l",
|
||||
"ń": "n",
|
||||
"ó": "o",
|
||||
"ś": "s",
|
||||
"ź": "z",
|
||||
"ż": "z",
|
||||
}
|
||||
|
||||
|
||||
def remove_diacritics(text: str, /) -> str:
|
||||
"""
|
||||
Replaces Polish diacritics with their ASCII counterparts
|
||||
|
||||
Żółć => Zolc
|
||||
Źdźbło => Zdzblo
|
||||
"""
|
||||
for (diacritic, ascii) in POLISH_DIACRITICS.items():
|
||||
text = text.replace(diacritic, ascii)
|
||||
|
||||
return text
|
Loading…
Reference in a new issue