-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: support telegram bot #4
base: main
Are you sure you want to change the base?
Conversation
68c9789
to
552281a
Compare
Rebased |
@@ -11,8 +11,24 @@ import ( | |||
"github.com/desmos-labs/hephaestus/types" | |||
) | |||
|
|||
// CmdHandler represents a function that extends a disgord.HandlerMessageCreate to allow it to return an error | |||
type CmdHandler = func(s disgord.Session, h *disgord.MessageCreate) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move CmdHandler
from types
folder since telegram and discord have different handler structure.
Codecov ReportBase: 64.61% // Head: 64.61% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #4 +/- ##
=======================================
Coverage 64.61% 64.61%
=======================================
Files 1 1
Lines 65 65
=======================================
Hits 42 42
Misses 16 16
Partials 7 7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -41,7 +41,6 @@ func (bot *Bot) HandleSendTokens(s disgord.Session, data *disgord.MessageCreate) | |||
} | |||
|
|||
log.Debug().Str(types.LogRecipient, recipient).Str(LogTxHash, res.TxHash).Msg("tokens sent successfully") | |||
bot.SetCommandLimitation(msg.Author.ID, types.CmdSend) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it since it should be handled in Handler
.
@@ -76,42 +75,42 @@ func ReadLimitations(file string) (map[string]*UserLimitations, error) { | |||
return limitations, json.Unmarshal(bz, &limitations) | |||
} | |||
|
|||
func GetLimitationExpiration(userID disgord.Snowflake, command string) (*time.Time, error) { | |||
func GetLimitationExpiration(userID string, command string) (*time.Time, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace disgord.Snowflake
into string
since disgord.Snowflake
is the discord spec.
types.CmdHelp, | ||
types.CmdDocs, | ||
types.CmdSend, | ||
types.CmdConnect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telegram bot does not implement CmdVerifiy
since we are not active on Telegarm.
Description
This PR extends Hephaetus to support telegram bot.
Checklist
Files changed
in the Github PR explorer.