Closed rsek closed 2 years ago
ref: #17
ha, i think i assumed 'default' meant something other than... you know, the actual default value of an optional slash command parameter. which i've now implemented in action-pc-roll
and it appears to work. i've left it out from various pc editing commands however, because that takes more work to undo than a roll (which can simply be ignored) with the incorrect PC than to undo changing their stats. still, i think it bears user testing, so i'll probably add it tomorrow.
i also think action-pc-roll
could benefit from its roll result embed including the character name so that it's clear what PC has just been rolled. since the roll embed has a user-settable Description field, i think this would be best done in the Author field alongside the stat, e.g. "Action Roll: Marc Progress, +Edge"
/action-pc-roll
now handles bad PlayerCharacter IDs by providing a list of the GuildPlayer's owned PCs as MessageComponents (buttons or a select menu, depending on the number). on interaction, they forward the roll's parameters to an ActionRoll by that character.
i also removed the autocomplete list sorting since it's not doing much.
todo:
i think this is pretty usable now. still haven't tracked down why the link isn't working in this specific instance - may just be some quirk of ephemerals, i'm not sure. but at this point i think there'd be more benefit to getting it into people's hands and seeing how they react to it.
resolves #17 : adds
GuildPlayer
(and a coresponding DbSet,GuildPlayers
), which is keyed by both user id and guild id, intended to hold user preferences at the per-guild level. at the moment it's mainly a vehicle forLastUsedPcId
.discord appears to cache some autocomplete results (and their ordering) in the client, so sorting by last used PlayerCharacter may not be possible. i suspect this an intentional design choice by discord: when the DB adds a new character, it adds them to the bottom of the autocomplete list without altering the order of the previous items. it does consistently update after the bot restarts (the only way i was able to tell the sorting was actually working, in fact), but there may be other triggers (restarting the client? time elapsing?).
i've left the
OrderByDescending
in there for now for further testing, but i suspect may not be possible to reorder the results after everyLastUsedPcId
change.other things i need to resolve before this is merged:
AfterExecute
overrides to handle saving to the DB when characters are altered. in my limited tests they seem to work fine, but it's a pretty small test case, and i haven't seen them used elsewhere in the bot. so if they're a bad idea to use for some reason, let me know and i can remove them.