-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: Phase 1 — shared helpers rollout (respond_error + typed config accessors) #122
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
Changes from all commits
619ff92
2eab52a
bca4124
8635da0
f9b9672
003898f
447b1b0
3e23343
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
|
|
||
| from easycord import Plugin, slash | ||
| from easycord.server_config import ServerConfigStore | ||
| from ._shared import respond_error | ||
|
rolling-codes marked this conversation as resolved.
|
||
|
|
||
| if TYPE_CHECKING: | ||
| from easycord import Context | ||
|
|
@@ -320,7 +321,7 @@ async def birthday_unset(self, ctx: Context) -> None: | |
| data: dict = cfg.get_other("birthday", {}) | ||
| birthdays: dict = data.get("birthdays", {}) | ||
| if str(user_id) not in birthdays: | ||
| await ctx.respond("You don't have a birthday registered.", ephemeral=True) | ||
| await respond_error(ctx, "You don't have a birthday registered.") | ||
|
rolling-codes marked this conversation as resolved.
|
||
| return | ||
|
Comment on lines
+324
to
325
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "== graph availability =="
if [ -f graphify-out/graph.json ]; then
wc -l graphify-out/graph.json
python3 - <<'PY'
import json
from pathlib import Path
p=Path("graphify-out/graph.json")
data=json.loads(p.read_text())
for k in ("nodes","edges"):
print(k, len(data.get(k, [])))
PY
else
echo "missing graphify-out/graph.json"
fi
echo
echo "== locate birthday.py/reminder.py/reputation.py =="
fd -a '^(birthday|reminder|reputation)\.py$' . | sed 's#^\./##'
echo
echo "== inspect birthday.py context/lock/respond_error =="
if [ -f easycord/plugins/birthday.py ]; then
wc -l easycord/plugins/birthday.py
rg -n "(_guild_lock|respond_error|mutate|discord|ctx\.*send|get_member|Interaction|on/)?" easycord/plugins/birthday.py || true
sed -n '280,345p' easycord/plugins/birthday.py || true
fi
echo
echo "== inspect reminder.py context/lock/respond_error =="
if [ -f easycord/plugins/reminder.py ]; then
wc -l easycord/plugins/reminder.py
rg -n "(_guild_lock|respond_error|mutate|discord|ctx\.*send|get_member|Interaction|on/)" easycord/plugins/reminder.py || true
sed -n '280,325p' easycord/plugins/reminder.py || true
fi
echo
echo "== inspect reputation.py context/lock/respond_error =="
if [ -f easycord/plugins/reputation.py ]; with
wc -l easycord/plugins/reputation.py
rg -n "(_guild_lock|respond_error|mutate|discord|ctx\.*send|get_member|Interaction|on/)" easycord/plugins/reputation.py || true
sed -n '90,135p' easycord/plugins/reputation.py || true
fi
echo
echo "== definitions of respond_error and guild lock helpers =="
rg -n "def respond_error|class .*Guild|_guild_lock|ServerConfigStore\.mutate|per-guild|guild_lock|async with|with .*lock|lock_context" easycord -S || trueRepository: rolling-codes/EasyCord Length of output: 22232 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "== graph availability =="
if [ -f graphify-out/graph.json ]; then
wc -l graphify-out/graph.json
python3 - <<'PY'
import json
from pathlib import Path
p=Path("graphify-out/graph.json")
data=json.loads(p.read_text())
for k in ("nodes","edges"):
print(k, len(data.get(k, [])))
PY
else
echo "missing graphify-out/graph.json"
fi
echo
echo "== locate birthday.py/reminder.py/reputation.py =="
fd -a '^(birthday|reminder|reputation)\.py$' . | sed 's#^\./##'
echo
echo "== inspect birthday.py context/lock/respond_error =="
if [ -f easycord/plugins/birthday.py ]; then
wc -l easycord/plugins/birthday.py
rg -n "(_guild_lock|respond_error|mutate|discord|ctx\.*send|get_member|Interaction|on/?) " easycord/plugins/birthday.py || true
sed -n '280,345p' easycord/plugins/birthday.py || true
fi
echo
echo "== inspect reminder.py context/lock/respond_error =="
if [ -f easycord/plugins/reminder.py ]; then
wc -l easycord/plugins/reminder.py
rg -n "(_guild_lock|respond_error|mutate|discord|ctx\.*send|get_member|Interaction|on/?)" easycord/plugins/reminder.py || true
sed -n '280,330p' easycord/plugins/reminder.py || true
fi
echo
echo "== inspect reputation.py context/lock/respond_error =="
if [ -f easycord/plugins/reputation.py ]; then
wc -l easycord/plugins/reputation.py
rg -n "(_guild_lock|respond_error|mutate|discord|ctx\.*send|get_member|Interaction|on/?)" easycord/plugins/reputation.py || true
sed -n '90,145p' easycord/plugins/reputation.py || true
fi
echo
echo "== definitions of respond_error and guild lock helpers =="
rg -n "def respond_error|class .*Guild|_guild_lock|ServerConfigStore\.mutate|per-guild|guild_lock|async with|with .*lock|lock_context" easycord -S || trueRepository: rolling-codes/EasyCord Length of output: 25093 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "== inspect easycord/_shared.py respond_error =="
wc -l easycord/_shared.py
sed -n '1,80p' easycord/_shared.py
echo
echo "== inspect easycord/interaction helpers that define respond_error =="
rg -n "def respond_error|async def respond_error|ctx\.respond" easycord -g '*.py' | head -80Repository: rolling-codes/EasyCord Length of output: 259 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "== shared module candidates =="
fd -a 'shared\.py$|_shared\.py$' easycord plugins . 2>/dev/null | sed 's#^\./##' | sort | head -80
echo
echo "== inspect respondent_error definitions =="
rg -n "async def respond_error|def respond_error|respond_error =" easycord -g '*.py' -S
echo
echo "== inspect birthday/reminders/reputation relevant slices =="
sed -n '290,330p' easycord/plugins/birthday.py
sed -n '296,316p' easycord/plugins/reminder.py
sed -n '112,126p' easycord/plugins/reputation.pyRepository: rolling-codes/EasyCord Length of output: 3510 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "== inspect easycord/plugins/_shared.py respond_error =="
sed -n '1,70p' easycord/plugins/_shared.py
echo
echo "== inspect interaction context respond_error wrapper =="
sed -n '1,80p' easycord/helpers/context.pyRepository: rolling-codes/EasyCord Length of output: 5431 Move
As per the per-guild config guideline, Discord/network I/O must not occur while the per-guild configuration lock is held. 📍 Affects 3 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| birthdays.pop(str(user_id), None) | ||
| data["birthdays"] = birthdays | ||
|
|
@@ -392,7 +393,7 @@ async def birthday_list(self, ctx: Context) -> None: | |
| sorted_entries = _sort_upcoming(birthdays, today) | ||
|
|
||
| if not sorted_entries: | ||
| await ctx.respond("No birthdays have been registered yet.", ephemeral=True) | ||
| await respond_error(ctx, "No birthdays have been registered yet.") | ||
| return | ||
|
|
||
| lines: list[str] = [] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.