Skip to content

Commit

Permalink
fixed old reference in sanitize function
Browse files Browse the repository at this point in the history
  • Loading branch information
Arturomtz8 committed Sep 18, 2023
1 parent 661ce70 commit d44ba0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const templ = `
{{.HtmlURL}}
`

var lenSearchCommand int = len(searchCommand)
var lenTrendingCommand int = len(trendingCommand)

// Chat struct stores the id of the chat in question.
type Chat struct {
Expand Down Expand Up @@ -159,9 +159,9 @@ func parseTelegramRequest(r *http.Request) (*Update, error) {
// returns the term that wants to be searched or
// an string that specifies the expected input
func sanitize(s string) (string, error) {
if len(s) >= lenSearchCommand {
if s[:lenSearchCommand] == searchCommand {
s = s[lenSearchCommand:]
if len(s) >= lenTrendingCommand {
if s[:lenTrendingCommand] == trendingCommand {
s = s[lenTrendingCommand:]
s = strings.TrimSpace(s)
fmt.Printf("type of value entered: %T\n", s)
}
Expand Down

0 comments on commit d44ba0a

Please sign in to comment.