Skip to content
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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

feat: support telegram bot #4

wants to merge 16 commits into from

Conversation

dadamu
Copy link

@dadamu dadamu commented Aug 17, 2022

Description

This PR extends Hephaetus to support telegram bot.

Checklist

  • Targeted PR against correct branch.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit tests.
  • Re-reviewed Files changed in the Github PR explorer.

@dadamu dadamu changed the title Paul/telegram bot feat: support telegram bot Aug 17, 2022
@dadamu
Copy link
Author

dadamu commented Oct 17, 2022

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
Copy link
Author

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
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Base: 64.61% // Head: 64.61% // No change to project coverage 👍

Coverage data is based on head (552281a) compared to base (19e8cd2).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 552281a differs from pull request most recent head 768fe1a. Consider uploading reports for the commit 768fe1a to get more accurate results

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           
Impacted Files Coverage Δ
limitations/limitation.go 64.61% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -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)
Copy link
Author

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) {
Copy link
Author

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.

@dadamu dadamu requested a review from RiccardoM October 17, 2022 03:22
Comment on lines +20 to +23
types.CmdHelp,
types.CmdDocs,
types.CmdSend,
types.CmdConnect,
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant