diff --git a/internal/engine/command/calculator/calculator.go b/internal/engine/command/calculator/calculator.go index 12657d91..21b2c13f 100644 --- a/internal/engine/command/calculator/calculator.go +++ b/internal/engine/command/calculator/calculator.go @@ -20,7 +20,7 @@ func (c *CalculatorCmd) GetCommand() *command.Command { subCmdCalcReward := &command.Command{ Name: "reward", Help: "Calculate the PAC coins you can earn based on your validator stake", - Args: []command.Args{ + Args: []*command.Args{ { Name: "stake", Desc: "The amount of stake in your validator", diff --git a/internal/engine/command/command.go b/internal/engine/command/command.go index b37b38ea..398df488 100644 --- a/internal/engine/command/command.go +++ b/internal/engine/command/command.go @@ -96,7 +96,7 @@ type Command struct { Emoji string `yaml:"emoji"` Name string `yaml:"name"` Help string `yaml:"help"` - Args []Args `yaml:"args"` + Args []*Args `yaml:"args"` SubCommands []*Command `yaml:"sub_commands"` ResultTemplate string `yaml:"result_template"` Middlewares []MiddlewareFunc `yaml:"-"` diff --git a/internal/engine/command/crowdfund/crowdfund.gen.go b/internal/engine/command/crowdfund/crowdfund.gen.go index 359b3dc4..89897a6f 100644 --- a/internal/engine/command/crowdfund/crowdfund.gen.go +++ b/internal/engine/command/crowdfund/crowdfund.gen.go @@ -34,7 +34,7 @@ func (c *CrowdfundCmd) crowdfundCommand() *command.Command { ResultTemplate: `Crowdfund campaign '{{.campaign.Title}}' created successfully with {{ .campaign.Packages | len }} packages`, AppIDs: entity.AllAppIDs(), TargetFlag: command.TargetMaskAll, - Args: []command.Args{ + Args: []*command.Args{ { Name: "title", Desc: "The title of this crowdfunding campaign", @@ -97,7 +97,7 @@ Once the payment is done, you can claim your PAC coins using "claim" command. Thanks`, AppIDs: entity.AllAppIDs(), TargetFlag: command.TargetMaskAll, - Args: []command.Args{ + Args: []*command.Args{ { Name: "package", Desc: "Select the crowdfunding package", diff --git a/internal/engine/command/crowdfund/crowdfund.go b/internal/engine/command/crowdfund/crowdfund.go index 7b370ffd..cabbeaad 100644 --- a/internal/engine/command/crowdfund/crowdfund.go +++ b/internal/engine/command/crowdfund/crowdfund.go @@ -37,6 +37,20 @@ func (c *CrowdfundCmd) activeCampaign() *entity.CrowdfundCampaign { func (c *CrowdfundCmd) GetCommand() *command.Command { cmd := c.crowdfundCommand() + subCmdCreate.AppIDs = []entity.PlatformID{entity.PlatformIDCLI, entity.PlatformIDDiscord} + subCmdDisable.AppIDs = []entity.PlatformID{entity.PlatformIDCLI, entity.PlatformIDDiscord} + subCmdReport.AppIDs = entity.AllAppIDs() + subCmdInfo.AppIDs = entity.AllAppIDs() + subCmdPurchase.AppIDs = entity.AllAppIDs() + subCmdClaim.AppIDs = entity.AllAppIDs() + + subCmdCreate.TargetFlag = command.TargetMaskModerator + subCmdDisable.TargetFlag = command.TargetMaskModerator + subCmdReport.TargetFlag = command.TargetMaskMainnet + subCmdInfo.TargetFlag = command.TargetMaskMainnet + subCmdPurchase.TargetFlag = command.TargetMaskMainnet + subCmdClaim.TargetFlag = command.TargetMaskMainnet + activeCampaign := c.activeCampaign() if activeCampaign != nil { purchaseChoices := []command.Choice{} diff --git a/internal/engine/command/crowdfund/crowdfund.yml b/internal/engine/command/crowdfund/crowdfund.yml index 72e108b8..956422a4 100644 --- a/internal/engine/command/crowdfund/crowdfund.yml +++ b/internal/engine/command/crowdfund/crowdfund.yml @@ -31,7 +31,7 @@ sub_commands: Packages: {{range .campaign.Packages}} - - {{.Name}} + - {{.Name}}: {{.USDAmount}} USDT to {{.PACAmount}} PAC {{- end}} - name: purchase help: Make a purchase in a crowdfunding campaign diff --git a/internal/engine/command/market/market.go b/internal/engine/command/market/market.go index 345efd6b..e2863d55 100644 --- a/internal/engine/command/market/market.go +++ b/internal/engine/command/market/market.go @@ -23,7 +23,7 @@ func (m *MarketCmd) GetCommand() *command.Command { subCmdPrice := &command.Command{ Name: "price", Help: "Shows the latest price of PAC coin across different markets", - Args: []command.Args{}, + Args: []*command.Args{}, SubCommands: nil, AppIDs: entity.AllAppIDs(), Handler: m.priceHandler, diff --git a/internal/engine/command/network/network.go b/internal/engine/command/network/network.go index 2bfdb3ed..f3b9cd76 100644 --- a/internal/engine/command/network/network.go +++ b/internal/engine/command/network/network.go @@ -54,7 +54,7 @@ func (n *NetworkCmd) GetCommand() *command.Command { subCmdNodeInfo := &command.Command{ Name: "node-info", Help: "View information about a specific node", - Args: []command.Args{ + Args: []*command.Args{ { Name: "validator_address", Desc: "The validator address", @@ -71,7 +71,7 @@ func (n *NetworkCmd) GetCommand() *command.Command { subCmdHealth := &command.Command{ Name: "health", Help: "Check the network health status", - Args: []command.Args{}, + Args: []*command.Args{}, SubCommands: nil, AppIDs: entity.AllAppIDs(), Handler: n.healthHandler, @@ -81,7 +81,7 @@ func (n *NetworkCmd) GetCommand() *command.Command { subCmdStatus := &command.Command{ Name: "status", Help: "View network statistics", - Args: []command.Args{}, + Args: []*command.Args{}, SubCommands: nil, AppIDs: entity.AllAppIDs(), Handler: n.statusHandler, diff --git a/internal/engine/command/phoenix/phoenix.go b/internal/engine/command/phoenix/phoenix.go index 6df6c94c..60d8811d 100644 --- a/internal/engine/command/phoenix/phoenix.go +++ b/internal/engine/command/phoenix/phoenix.go @@ -38,7 +38,7 @@ func (p *PhoenixCmd) GetCommand() *command.Command { subCmdFaucet := &command.Command{ Name: "faucet", Help: fmt.Sprintf("Get %f tPAC Coins on Phoenix Testnet for Testing your code or project", p.faucetAmount.ToPAC()), - Args: []command.Args{ + Args: []*command.Args{ { Name: "address", Desc: "your testnet address [example: tpc1z...]", diff --git a/internal/engine/command/voucher/voucher.go b/internal/engine/command/voucher/voucher.go index c318fb80..38e59cd3 100644 --- a/internal/engine/command/voucher/voucher.go +++ b/internal/engine/command/voucher/voucher.go @@ -28,7 +28,7 @@ func (v *VoucherCmd) GetCommand() *command.Command { subCmdClaim := &command.Command{ Name: "claim", Help: "Claim voucher coins and bond them to a validator", - Args: []command.Args{ + Args: []*command.Args{ { Name: "code", Desc: "The voucher code", @@ -52,7 +52,7 @@ func (v *VoucherCmd) GetCommand() *command.Command { subCmdCreateOne := &command.Command{ Name: "create-one", Help: "Generate a single voucher code", - Args: []command.Args{ + Args: []*command.Args{ { Name: "amount", Desc: "The amount of PAC to bond", @@ -88,7 +88,7 @@ func (v *VoucherCmd) GetCommand() *command.Command { subCmdCreateBulk := &command.Command{ Name: "create-bulk", Help: "Generate multiple voucher codes by importing a file", - Args: []command.Args{ + Args: []*command.Args{ { Name: "file", Desc: "File containing a list of voucher recipients", @@ -112,7 +112,7 @@ func (v *VoucherCmd) GetCommand() *command.Command { subCmdStatus := &command.Command{ Name: "status", Help: "View the status of vouchers or a specific voucher", - Args: []command.Args{ + Args: []*command.Args{ { Name: "code", Desc: "The voucher code (8 characters)", diff --git a/internal/engine/command/zealy/zealy.go b/internal/engine/command/zealy/zealy.go index c8b9e85a..55dde13f 100644 --- a/internal/engine/command/zealy/zealy.go +++ b/internal/engine/command/zealy/zealy.go @@ -23,7 +23,7 @@ func (z *ZealyCmd) GetCommand() *command.Command { subCmdClaim := &command.Command{ Name: "claim", Help: "Claim your Zealy reward", - Args: []command.Args{ + Args: []*command.Args{ { Name: "address", Desc: "The Pactus address where the reward will be claimed", diff --git a/internal/platforms/telegram/telegram.go b/internal/platforms/telegram/telegram.go index b8d32095..a1e4a190 100644 --- a/internal/platforms/telegram/telegram.go +++ b/internal/platforms/telegram/telegram.go @@ -220,7 +220,7 @@ func (bot *Bot) parsTextMessage(ctx tele.Context) error { return ctx.Send(fmt.Sprintf("Please Enter %s", cmd.Args[currentArgsIndex+1].Name)) } -func (bot *Bot) handleArgCommand(ctx tele.Context, commands []string, args []command.Args) error { +func (bot *Bot) handleArgCommand(ctx tele.Context, commands []string, args []*command.Args) error { msgCtx := &BotContext{Commands: commands} argsContext[ctx.Sender().ID] = msgCtx argsValue[ctx.Sender().ID] = nil