-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code has been commented and optimized
- Loading branch information
Anton Ugryumov
committed
May 20, 2017
1 parent
264ce16
commit 117622f
Showing
10 changed files
with
132 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package functions | ||
|
||
import ( | ||
"main/web/vk" | ||
"main/kernel/cache" | ||
"main/kernel/interception" | ||
"strconv" | ||
) | ||
|
||
const messageSendMethod = "messages.send" | ||
|
||
//args for bot commands | ||
type FuncArgs struct { | ||
ApiChan vk.ChanKit //ChanKit for safety API requests | ||
Message vk.Message //Message from user | ||
DataCache cache.DataCache //Cache of data | ||
InterceptIndications interception.Indications //Interception tools | ||
} | ||
|
||
//Send message back to the user | ||
func (args *FuncArgs) Reply(message string, attach ...string) { | ||
var attachments string | ||
|
||
if len(attachments) != 0 { | ||
attachments = attach[0] | ||
} | ||
|
||
args.ApiChan.MakeRequest(messageSendMethod, map[string]string{ | ||
"user_id": strconv.FormatInt(args.Message.UserId, 10), | ||
"message": message, | ||
"attachments": attachments, | ||
}) | ||
} |
Oops, something went wrong.