func (m *Manager) Restart() (err error) {
	m.RLock()
	mgr, err := New(m.token)
	if err != nil {
		m.RUnlock()
		return
	}
	for _, handler := range m.handlers {
		mgr.AddHandler(handler)
	}
	m.RUnlock()
	err = mgr.Start()
	if err != nil {
		return
	}
	m.Shutdown()
	m.Lock()
	defer m.Unlock()
	m = mgr
	return
}
Restart restarts the Manager, and rescales if necessary, all with
zero downtime.
package shards
import (
	"sync"
	"time"
	"github.com/bwmarrin/discordgo"
)
type Manager struct {
	sync.RWMutex
	Gateway *discordgo.Session
	Intent discordgo.Intent
	Shards []*Shard
	ShardCount int
	handlers []interface{}
	token string
}
func (m *Manager) AddHandler(handler interface{}) {
	m.Lock()
	defer m.Unlock()
	m.handlers = append(m.handlers, handler)
	for _, shard := range m.Shards {
		shard.AddHandler(handler)
	}
}
func (m *Manager) ApplicationCommandCreate(guildID string, cmd *discordgo.ApplicationCommand) (errs []error) {
	m.Lock()
	defer m.Unlock()
	for _, shard := range m.Shards {
		err := shard.ApplicationCommandCreate(guildID, cmd)
		if err != nil {
			errs = append(errs, err)
		}
	}
	return
}
func (m *Manager) GuildCount() (count int) {
	m.RLock()
	defer m.RUnlock()
	for _, shard := range m.Shards {
		count += shard.GuildCount()
	}
	return
}
func New(token string) (mgr *Manager, err error) {
	mgr = &Manager{
		token: token,
	}
	mgr.Gateway, err = discordgo.New(token)
	resp, err := mgr.Gateway.GatewayBot()
	if err != nil {
		return
	}
	if resp.Shards < 1 {
		mgr.ShardCount = 1
	} else {
		mgr.ShardCount = resp.Shards
	}
	return
}
func (m *Manager) SetShardCount(count int) {
	m.Lock()
	defer m.Unlock()
	if count > 0 {
		m.ShardCount = count
	}
}
func (m *Manager) RegisterIntent(intent discordgo.Intent) {
	m.Lock()
	defer m.Unlock()
	m.Intent = intent
}
func (m *Manager) SessionForDM() *discordgo.Session {
	m.RLock()
	defer m.RUnlock()
	return m.Shards[0].Session
}
func (m *Manager) SessionForGuild(guildID int64) *discordgo.Session {
	m.RLock()
	defer m.RUnlock()
	return m.Shards[(guildID>>22)%int64(m.ShardCount)].Session
}