update
This commit is contained in:
+2
-1
@@ -82,9 +82,10 @@ func handleMessage(sender Sender) {
|
||||
defer sender.Finish()
|
||||
key := fmt.Sprintf("u=%v&c=%v&i=%v", sender.GetUserID(), sender.GetChatID(), sender.GetImType())
|
||||
fmt.Println(key)
|
||||
fmt.Println(waits.Load(key))
|
||||
if v, ok := waits.Load(key); ok {
|
||||
c := v.(Carry)
|
||||
fmt.Println(c, "-----")
|
||||
|
||||
if m := regexp.MustCompile(c.Pattern).FindString(sender.GetContent()); m != "" {
|
||||
c.Chan <- m
|
||||
sender.Reply(<-c.Result)
|
||||
|
||||
+2
-2
@@ -245,10 +245,10 @@ func (sender *BaseSender) Await(callback func(string, error) interface{}, params
|
||||
c.Result = make(chan interface{}, 1)
|
||||
key := fmt.Sprintf("u=%v&c=%v&i=%v", sender.GetUserID(), sender.GetChatID(), sender.GetImType())
|
||||
if oc, ok := waits.LoadOrStore(key, c); ok {
|
||||
fmt.Println(waits.LoadOrStore(key, c))
|
||||
oc.(Carry).Chan <- InterruptError
|
||||
}
|
||||
fmt.Println(waits.LoadOrStore(key, c))
|
||||
fmt.Println(key)
|
||||
fmt.Println(waits.Load(key))
|
||||
select {
|
||||
case result := <-c.Chan:
|
||||
switch result.(type) {
|
||||
|
||||
Reference in New Issue
Block a user