Skip to content

Commit fdd2254

Browse files
authored
Merge branch 'allthingslinux:main' into main
2 parents 8bcb93e + 45e00f0 commit fdd2254

22 files changed

+1853
-686
lines changed

.cursorrules

+3-35
Original file line numberDiff line numberDiff line change
@@ -127,45 +127,13 @@
127127
},
128128
"error_handling": {
129129
"prefer_try_catch": true,
130-
"log_errors": true
131-
},
132-
"naming_conventions": {
133-
"variables": "snake_case",
134-
"functions": "snake_case",
135-
"classes": "PascalCase",
136-
"interfaces": "PascalCase",
137-
"files": "snake_case"
138-
}
139-
},
140-
"project_configuration": {
141-
"language": "Python",
142-
"version": "3.13.2",
143-
"dependencies": {
144-
"management_tool": "Poetry",
145-
"libraries": [
146-
"discord.py",
147-
"pyright",
148-
"prisma",
149-
"ruff",
150-
"loguru",
151-
"httpx",
152-
"pre-commit",
153-
"sentry-sdk",
154-
"python-dotenv",
155-
"pytz",
156-
"pillow",
157-
"rich",
158-
"aiofiles",
159-
"reactionmenu"
160-
]
130+
"log_errors": true,
131+
"logging_tool": "Loguru",
132+
"exception_management": "Sentry and handlers/error.py"
161133
},
162134
"development": {
163135
"environment": "Docker",
164136
"deployment_tool": "Docker Compose"
165-
},
166-
"error_handling": {
167-
"logging_tool": "Loguru",
168-
"exception_management": "Sentry and handlers/error.py"
169137
}
170138
}
171139
}

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
python: "3.13.2"
2+
python: python3.13
33

44
repos:
55
# 1. Fast File Checks
@@ -31,15 +31,15 @@ repos:
3131
# 3. Main Linter (with auto-fix)
3232
- repo: https://github.com/astral-sh/ruff-pre-commit
3333
# Ruff version should match the one in pyproject.toml
34-
rev: v0.11.5 # Use the same Ruff version tag as formatter
34+
rev: v0.11.6 # Use the same Ruff version tag as formatter
3535
hooks:
3636
- id: ruff
3737
args: [--fix]
3838

3939
# 4. Main Formatter (after linting/fixing)
4040
- repo: https://github.com/astral-sh/ruff-pre-commit
4141
# Ruff version should match the one in pyproject.toml
42-
rev: v0.11.5
42+
rev: v0.11.6
4343
hooks:
4444
- id: ruff-format
4545

.trunk/.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*out
2+
*logs
3+
*actions
4+
*notifications
5+
*tools
6+
plugins
7+
user_trunk.yaml
8+
user.yaml
9+
tmp

.trunk/trunk.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
2+
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
3+
version: 0.1
4+
cli:
5+
version: 1.22.12
6+
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
7+
plugins:
8+
sources:
9+
- id: trunk
10+
ref: v1.6.8
11+
uri: https://github.com/trunk-io/plugins
12+
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
13+
runtimes:
14+
enabled:
15+
16+
17+
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
18+
lint:
19+
disabled:
20+
- bandit
21+
- black
22+
- ruff
23+
enabled:
24+
25+
26+
- git-diff-check
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
actions:
39+
disabled:
40+
- trunk-announce
41+
- trunk-check-pre-push
42+
- trunk-fmt-pre-commit
43+
enabled:
44+
- trunk-upgrade-available

assets/emojis/tempban.png

5.53 KB
Loading

docker-compose.dev.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
# NOTE: This file is used for local development purposes only.
24

35
services:

docker-compose.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
# NOTE: This file is used for production deployment.
24

35
services:
@@ -11,6 +13,7 @@ services:
1113
volumes:
1214
- ./config:/app/config:ro
1315
- ./tux:/app/tux
16+
- ./assets:/app/assets
1417
env_file:
1518
- .env
16-
restart: unless-stopped
19+
restart: unless-stopped

poetry.lock

+369-328
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ types-dateparser = ">=1.2.0.20240420"
6161
types-psutil = ">=6.0.0.20240621"
6262
types-pytz = ">=2024.2.0.20240913"
6363
types-pyyaml = ">=6.0.12.20240808"
64+
types-pillow = "^10.2.0.20240822"
6465

6566
[tool.poetry.group.docs.dependencies]
6667
mkdocs-material = "^9.5.30"

tux/bot.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from tux.database.client import db
2323
from tux.utils.banner import create_banner
2424
from tux.utils.config import Config
25+
from tux.utils.emoji import EmojiManager
2526
from tux.utils.env import is_dev_mode
2627
from tux.utils.sentry import start_span, start_transaction
2728

@@ -84,6 +85,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
8485
# Store for tracking Sentry transactions by command/interaction ID
8586
self.active_sentry_transactions: dict[int, Any] = {}
8687

88+
# Emoji manager
89+
self.emoji_manager = EmojiManager(self)
90+
8791
# Create console for rich output
8892
self.console = Console(stderr=True, force_terminal=True)
8993

@@ -246,8 +250,9 @@ async def on_ready(self) -> None:
246250
Performs initialization tasks when the bot connects to Discord:
247251
1. Records start time if not set
248252
2. Ensures setup is complete
249-
3. Starts hot reloading for cogs (loaded as separate cog)
250-
4. Logs startup banner
253+
3. Initializes emoji manager
254+
4. Starts hot reloading for cogs (loaded as separate cog)
255+
5. Logs startup banner
251256
252257
Notes
253258
-----
@@ -264,6 +269,17 @@ async def on_ready(self) -> None:
264269
await self._wait_for_setup()
265270
transaction.set_tag("setup_complete", self.setup_complete)
266271

272+
# Initialize emoji manager after bot is connected to Discord
273+
with start_span("bot.init_emoji_manager", "Initializing emoji manager") as span:
274+
try:
275+
await self.emoji_manager.init()
276+
logger.info("Emoji manager initialized")
277+
span.set_tag("emoji_manager.initialized", True)
278+
except Exception as e:
279+
logger.warning(f"Failed to initialize emoji manager: {e}")
280+
span.set_tag("emoji_manager.initialized", False)
281+
span.set_data("error", str(e))
282+
267283
# Start hot reloading - import at function level to avoid circular imports
268284
with start_span("bot.load_hot_reload", "Setting up hot reload") as span:
269285
try:

0 commit comments

Comments
 (0)