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

Incorrectly formatted user message can cause runtime panic #6

Open
sharkmoos opened this issue Aug 20, 2023 · 0 comments · May be fixed by #9
Open

Incorrectly formatted user message can cause runtime panic #6

sharkmoos opened this issue Aug 20, 2023 · 0 comments · May be fixed by #9
Assignees

Comments

@sharkmoos
Copy link
Owner

sharkmoos commented Aug 20, 2023

Currently the code assumes that a string with https:// exists in the user message. A message without a link would cause a runtime error.

link := "https://" + strings.Split(content, "https://")[1]
// Respond to the message with the link
response := fmt.Sprintf("Received link: %s", link)
if _, err := s.ChannelMessageSend(m.ChannelID, response); err != nil {
fmt.Println("Error sending message:", err)
}

@sharkmoos sharkmoos self-assigned this Aug 20, 2023
@sharkmoos sharkmoos linked a pull request Aug 23, 2023 that will close this issue
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 a pull request may close this issue.

1 participant