Move the report commands into exp_reports

The create-report, get-reports and clear-reports commands now live in the
plugin's own module next to the functions they call, with their locale.
The permissions keep their exp_scenario.command names because the command
authority derives them from the command name.

The Discord report alert in exp_scenario is gone since exp_reports posts to
its own webhook. The shared add_player stub takes an options table with
connected and admin defaulting to true and false, replacing the copy in
the exp_reports test environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-09-26 23:22:18 +00:00
1 parent e47f41d440
commit 9ddb7b362b
20 files changed
+95 -155

No files matched your search

-13
View File
@@ -13,15 +13,10 @@ local plugin_root = assert(source:match("^@(.*)/test/module/env%.lua$"))
local Framework = assert(loadfile(shared_root .. "/framework.lua"))() --- @type Framework
--- A stubbed player which also carries the admin flag the module reads
--- @class ExpReports.TestPlayer : Stubs.Player
--- @field admin boolean
--- The environment given to each test: the stubs extended with a fresh copy
--- of the reports module and the fixture helpers
--- @class ExpReports.TestEnv : Stubs
--- @field Reports ExpReports A fresh copy of the reports module
--- @field add_player fun(name: string, is_connected: boolean?, is_admin: boolean?): ExpReports.TestPlayer
--- @field report fun(player_name: string, by_player_name: string, reason: string?): ExpReports.Report A report as the controller sends it
return Framework.suite(function(env)
@@ -34,14 +29,6 @@ return Framework.suite(function(env)
}
env.Reports = assert(loadfile(plugin_root .. "/module/control.lua"))() --- @type ExpReports
-- The module reads player.admin, which the strict stub raises on unless it is set
local add_player = env.add_player
function env.add_player(name, is_connected, is_admin)
local player = add_player(name, is_connected) --[[@as ExpReports.TestPlayer]]
player.admin = is_admin == true
return player
end
local next_id = 0
function env.report(player_name, by_player_name, reason)
next_id = next_id + 1