Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pukimaa committed Dec 1, 2022
2 parents ff4e9b0 + 98e8e1e commit 1acd7ff
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitmoji-changelogrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"project": {
"name": "Tako",
"description": "A multipurpose Discord bot for everything",
"version": "0.1.0-beta"
"version": "0.1.1"
}
}
21 changes: 13 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# Changelog

<a name="0.1.0-alpha"></a>
## 0.1.0-alpha (2022-07-15)
<a name="0.1.1"></a>
## 0.1.1 (2022-12-01)

### Added

- 🎉 Initial Commit [[0fa12d5](https://github.com/tako-discord/tako/commit/0fa12d52e0af64a3a83c80b57b1e4a0d570e776e)]
- ✨ add adjustable confidence threshold for autotranslate [[968a62a](https://github.com/tako-discord/tako/commit/968a62ab912301ea23769d15b01ef227f1ec6ee0)]

### Changed

- 🚨 Linting [[71f8789](https://github.com/tako-discord/tako/commit/71f8789152f1dbed9c9b35f3900463424086fb44)]
- 🎨 Better note regarding the public bot [[2e42cec](https://github.com/tako-discord/tako/commit/2e42cecb26680fe71ce5665cfb43282eb0193b60)]

### Miscellaneous

- 🌐 New Crowdin Setup [[ea0aee9](https://github.com/tako-discord/tako/commit/ea0aee9dcd77fa8c8e607f25dfc50dc122d0fe7a)]
- 🌐 translation support for autotranslate [[4577c73](https://github.com/tako-discord/tako/commit/4577c73893270030de29e51dcfa11c4bed66cbdd)]
- 👥 add all remaining testers and new core dev [[5c1e5b8](https://github.com/tako-discord/tako/commit/5c1e5b8064bf01235e8a819ec52c9d020b1ef146)]


<a name="0.1.0-beta"></a>
## 0.1.0-beta (2022-12-01)

### Added

- 🎉 Initial Commit (Public Beta) [[5b6cf55](https://github.com/tako-discord/tako/commit/5b6cf5562f42daa636966d25a1d87c4a9d4fc47a)]


7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ Huge thanks to the discord.py Community, helping out if I had any question.
Another big thanks goes out to the users using this bot and all the contributors to this project.

Also huge thanks to the other (core) developer(s):
- [*@boloped*](https://github.com/boloped)
- [*LyQuid*](https://github.com/LyQuid12)

and all the testers:
- [*@vaporvee*](https://github.com/vaporvee)
- [*@abUwUser*](https://github.com/abUwUser)
- *Olex3#3259*
- [*@cmod31*](https://github.com/cmod31)
- [*@sheeepdev*](https://github.com/sheeepdev)
- [*@MeekOnGithub*](https://github.com/MeekOnGithub)
- *| Tzur |#3673*
- *Olex3#2900*
35 changes: 32 additions & 3 deletions cogs/misc/autotranslate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,30 @@ async def auto_translate(self, interaction: discord.Interaction, value: bool):
i18n.t(
f"misc.auto_translate_{'activated' if value else 'deactivated'}",
locale=get_language(self.bot, interaction.guild.id),
)
),
ephemeral=True,
)

@app_commands.command(
description="Adjust the confidence threshold for auto translate"
)
@app_commands.describe(value="The confidence threshold for auto translate.")
@app_commands.checks.has_permissions(manage_guild=True)
async def auto_translate_confidence(
self, interaction: discord.Interaction, value: app_commands.Range[int, 0, 100]
):
await self.bot.db_pool.execute(
"INSERT INTO guilds (guild_id, auto_translate_confidence) VALUES ($1, $2) ON CONFLICT(guild_id) DO UPDATE SET auto_translate_confidence = $2;",
interaction.guild.id,
value,
)
return await interaction.response.send_message(
i18n.t(
"misc.auto_translate_confidence_set",
value=value,
locale=get_language(self.bot, interaction.guild.id),
),
ephemeral=True,
)

@commands.Cog.listener()
Expand All @@ -46,11 +69,17 @@ async def on_message(self, message: discord.Message):
) as r:
data = await r.json()
data = data[0]
confidence = await self.bot.db_pool.fetchval(
"SELECT auto_translate_confidence FROM guilds WHERE guild_id = $1",
message.guild.id,
)
guild_language = get_language(self.bot, message.guild.id)
if data["language"] != guild_language or data["confidence"] < 5:
if confidence >= data["confidence"]:
return
if data["language"] != guild_language:
try:
await message.reply(
f"> {await translate(message.content, guild_language)}\n\n` {data['language']}{guild_language} `"
f"> {await translate(message.content, guild_language)}\n\n` {data['language']}{guild_language} | {round(data['confidence'])} `"
)
except discord.Forbidden:
return
2 changes: 1 addition & 1 deletion helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def main():
INSERT INTO badges (name, emoji, description) VALUES ('Translator', '🌐', 'Users who translated this bot receive this badge') ON CONFLICT DO NOTHING;
INSERT INTO badges (name, emoji, description) VALUES ('Core Developer', '🧑‍💻', 'Users who are the core developers from the the bot') ON CONFLICT DO NOTHING;
CREATE TABLE IF NOT EXISTS channels (channel_id BIGINT PRIMARY KEY, crosspost BOOLEAN NOT NULL);
CREATE TABLE IF NOT EXISTS guilds (guild_id BIGINT PRIMARY KEY, banned_games TEXT ARRAY, join_roles_user BIGINT ARRAY, join_roles_bot BIGINT ARRAY, language TEXT, reaction_translate BOOLEAN, auto_translate BOOLEAN DEFAULT FALSE, color TEXT);
CREATE TABLE IF NOT EXISTS guilds (guild_id BIGINT PRIMARY KEY, banned_games TEXT ARRAY, join_roles_user BIGINT ARRAY, join_roles_bot BIGINT ARRAY, language TEXT, reaction_translate BOOLEAN, auto_translate BOOLEAN DEFAULT FALSE, color TEXT, autp_translate_confidence INTEGER DEFAULT 50);
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE IF NOT EXISTS tags (id uuid DEFAULT uuid_generate_v4() PRIMARY KEY, name TEXT, content TEXT, thumbnail TEXT, image TEXT, footer TEXT, embed BOOLEAN DEFAULT TRUE, guild_id BIGINT);
CREATE TABLE IF NOT EXISTS users (user_id BIGINT PRIMARY KEY, wallet BIGINT DEFAULT 1000, bank BIGINT DEFAULT 0, last_meme TEXT);
Expand Down
3 changes: 3 additions & 0 deletions i18n/misc/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ en:
reaction_translate_activated: "✅ Reaction Translate is now activated"
reaction_translate_deactivated: "❌ Reaction Translate is now deactivated"
reaction_translate_footer: "Requested by %{user}"
auto_translate_activated: "✅ Autotranslate is now activated"
auto_translate_deactivated: "❌ Autotranslate is now deactivated"
auto_translate_confidence_set: "Confidence Threshold is now set to %{value}%"

0 comments on commit 1acd7ff

Please sign in to comment.