Compare commits
3 Commits
c18c81138a
...
db8fdfc95f
Author | SHA1 | Date |
---|---|---|
bitspill | db8fdfc95f | |
diamondburned | 2703326028 | |
bitspill | 0e24fffde0 |
|
@ -540,16 +540,16 @@ var optionSupportedSnowflakeTypes = map[reflect.Type]CommandOptionType{
|
|||
}
|
||||
|
||||
var optionKindMap = map[reflect.Kind]CommandOptionType{
|
||||
reflect.Int: NumberOptionType,
|
||||
reflect.Int8: NumberOptionType,
|
||||
reflect.Int16: NumberOptionType,
|
||||
reflect.Int32: NumberOptionType,
|
||||
reflect.Int64: NumberOptionType,
|
||||
reflect.Uint: NumberOptionType,
|
||||
reflect.Uint8: NumberOptionType,
|
||||
reflect.Uint16: NumberOptionType,
|
||||
reflect.Uint32: NumberOptionType,
|
||||
reflect.Uint64: NumberOptionType,
|
||||
reflect.Int: IntegerOptionType,
|
||||
reflect.Int8: IntegerOptionType,
|
||||
reflect.Int16: IntegerOptionType,
|
||||
reflect.Int32: IntegerOptionType,
|
||||
reflect.Int64: IntegerOptionType,
|
||||
reflect.Uint: IntegerOptionType,
|
||||
reflect.Uint8: IntegerOptionType,
|
||||
reflect.Uint16: IntegerOptionType,
|
||||
reflect.Uint32: IntegerOptionType,
|
||||
reflect.Uint64: IntegerOptionType,
|
||||
reflect.Float32: NumberOptionType,
|
||||
reflect.Float64: NumberOptionType,
|
||||
reflect.String: StringOptionType,
|
||||
|
|
|
@ -261,16 +261,18 @@ func (s *State) onEvent(iface interface{}) {
|
|||
}
|
||||
|
||||
case *gateway.MessageReactionAddEvent:
|
||||
var me bool
|
||||
if u, _ := s.Cabinet.Me(); u != nil {
|
||||
me = ev.UserID == u.ID
|
||||
}
|
||||
|
||||
s.editMessage(ev.ChannelID, ev.MessageID, func(m *discord.Message) bool {
|
||||
if i := findReaction(m.Reactions, ev.Emoji); i > -1 {
|
||||
// Copy the reactions slice so it's not racy.
|
||||
m.Reactions = append([]discord.Reaction(nil), m.Reactions...)
|
||||
m.Reactions[i].Count++
|
||||
m.Reactions[i].Me = m.Reactions[i].Me || me
|
||||
} else {
|
||||
var me bool
|
||||
if u, _ := s.Cabinet.Me(); u != nil {
|
||||
me = ev.UserID == u.ID
|
||||
}
|
||||
old := m.Reactions
|
||||
m.Reactions = make([]discord.Reaction, 0, len(old)+1)
|
||||
m.Reactions = append(m.Reactions, old...)
|
||||
|
@ -291,16 +293,13 @@ func (s *State) onEvent(iface interface{}) {
|
|||
}
|
||||
|
||||
r := &m.Reactions[i]
|
||||
newCount := r.Count - 1
|
||||
|
||||
switch {
|
||||
case newCount < 1: // If the count is 0:
|
||||
// If the count is 0:
|
||||
if (r.Count - 1) < 1 {
|
||||
old := m.Reactions
|
||||
m.Reactions = make([]discord.Reaction, len(m.Reactions)-1)
|
||||
copy(m.Reactions[0:], old[:i])
|
||||
copy(m.Reactions[i:], old[i+1:])
|
||||
|
||||
default:
|
||||
} else {
|
||||
r.Count--
|
||||
if r.Me { // If reaction removal is the user's
|
||||
u, err := s.Cabinet.Me()
|
||||
|
|
Loading…
Reference in New Issue