Fix it so replying to declined works
This commit is contained in:
parent
49203653d5
commit
26269d30f9
1 changed files with 7 additions and 1 deletions
8
main.go
8
main.go
|
|
@ -80,7 +80,13 @@ func main() {
|
||||||
if strings.Contains(repliedMsg.Text, "(no reason provided, reply to this to send one, prepend with + to also send to user)") {
|
if strings.Contains(repliedMsg.Text, "(no reason provided, reply to this to send one, prepend with + to also send to user)") {
|
||||||
// now we need to make sure the one that declined it is the one replying
|
// now we need to make sure the one that declined it is the one replying
|
||||||
lines := strings.Split(repliedMsg.Text, "\n")
|
lines := strings.Split(repliedMsg.Text, "\n")
|
||||||
if strings.TrimPrefix(lines[3], "Declined by: ") == update.Message.From.String() {
|
userString := ""
|
||||||
|
if update.Message.From.UserName != "" {
|
||||||
|
userString = "@" + update.Message.From.UserName
|
||||||
|
} else {
|
||||||
|
userString = fmt.Sprintf("%s %s", update.Message.From.FirstName, update.Message.From.LastName)
|
||||||
|
}
|
||||||
|
if strings.TrimPrefix(lines[3], "Declined by: ") == userString {
|
||||||
reason := escapeHTML(update.Message.Text)
|
reason := escapeHTML(update.Message.Text)
|
||||||
userID, username, joinReason, declinedBy, declinedAt := GetInfoFromMsg(repliedMsg.Text)
|
userID, username, joinReason, declinedBy, declinedAt := GetInfoFromMsg(repliedMsg.Text)
|
||||||
if strings.HasPrefix(update.Message.Text, "+") {
|
if strings.HasPrefix(update.Message.Text, "+") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue