commit d205f0283bcbdfb49beafe5636899b0ea7699f29
parent 2e30b57785f2b143496fc4151a3762f37daa6427
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 8 Dec 2023 22:06:15 -0500
Add /chips-reset command
Diffstat:
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/pkg/web/handlers/interceptors/slashInterceptor.go b/pkg/web/handlers/interceptors/slashInterceptor.go
@@ -89,7 +89,8 @@ var userCmdsMap = map[string]CmdHandler{
"/locate": handleLocateCmd,
"/error": handleErrorCmd,
"/chips": handleChipsBalanceCmd,
- "/chips-send": handleChipsSendCmd,
+ "/chips-reset": handleChipsResetCmd,
+ //"/chips-send": handleChipsSendCmd,
}
var privateRoomCmdsMap = map[string]CmdHandler{
@@ -1332,6 +1333,16 @@ func handleChipsSendCmd(c *command.Command) (handled bool) {
return
}
+func handleChipsResetCmd(c *command.Command) (handled bool) {
+ if c.Message == "/chips-reset" {
+ c.AuthUser.ChipsTest = 1000
+ c.AuthUser.DoSave(c.DB)
+ c.Err = command.ErrRedirect
+ return true
+ }
+ return
+}
+
func handleChipsBalanceCmd(c *command.Command) (handled bool) {
if c.Message == "/chips" {
c.ZeroMsg(fmt.Sprintf(`Balance: %d`, c.AuthUser.ChipsTest))
diff --git a/pkg/web/public/views/pages/chat-help.gohtml b/pkg/web/public/views/pages/chat-help.gohtml
@@ -155,6 +155,16 @@
<p>List all memes</p>
</div>
+ <div>
+ <div><code>/chips</code></div>
+ <p>Display your chips balance</p>
+ </div>
+
+ <div>
+ <div><code>/chips-reset</code></div>
+ <p>Reset your chips balance to 1000</p>
+ </div>
+
<h4>Private room commands</h4>
<h5>All users</h5>