-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvote.go
43 lines (36 loc) · 1.34 KB
/
vote.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/thoj/go-ircevent"
"strings"
)
//vote usage !vote name topic1 topic2 topic3
func startVote(username string, db string, connection *irc.Connection, channel string, message string, vote chan int) {
//if no topics do nothing
var voteTopics []string
voteTopics = strings.Split(message, " ")
if len(voteTopics) <= 2 {
return
}
//name vote
//var voteName string = voteTopics[1]
//store topics
//loop through the rest of the topics and store them
}
//Each user can cast a vote for an ongoing vote.
func castVote(username string, db string, connection *irc.Connection, channel string, message string) {
var voteInfo []string = strings.Split(message, " ")
if len(voteInfo) <= 1 {
return //we didn't get a thing to vote for
}
//check if a vote is happening for user at channel. if it is{
//store voteInfo[2] for the vote with name voteInfo[1] for that user. users can only have one vote
//}
}
//check how many votes have been cast for that user with that channel. Needs a name as well
func checkVotes(username string, db string, connection *irc.Connection, channel string, message string) {
return
}
//stop the voting for a certain user and channel with that name, assuming that the vote is still going.
func stopVote(username string, db string, connection *irc.Connection, channel string, message string) {
return
}