1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-05 19:57:02 +00:00

bot: Fix failing ./extras/middlewares test

This commit is contained in:
diamondburned 2023-11-03 19:35:40 -07:00
parent d9681ea1d1
commit ff709fc16c
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -168,6 +168,7 @@ type mockStore struct {
func mockCabinet() *store.Cabinet {
c := *store.NoopCabinet
c.RoleStore = &mockStore{}
c.GuildStore = &mockStore{}
c.MemberStore = &mockStore{}
c.ChannelStore = &mockStore{}
@ -178,13 +179,28 @@ func mockCabinet() *store.Cabinet {
func (s *mockStore) Guild(id discord.GuildID) (*discord.Guild, error) {
return &discord.Guild{
ID: id,
Roles: []discord.Role{{
}, nil
}
func (s *mockStore) Roles(id discord.GuildID) ([]discord.Role, error) {
return []discord.Role{
{
ID: 69420,
Permissions: discord.PermissionAdministrator,
}},
},
}, nil
}
func (s *mockStore) Role(_ discord.GuildID, roleID discord.RoleID) (*discord.Role, error) {
if roleID == 69420 {
return &discord.Role{
ID: roleID,
Permissions: discord.PermissionAdministrator,
}, nil
}
return nil, store.ErrNotFound
}
func (s *mockStore) Member(_ discord.GuildID, userID discord.UserID) (*discord.Member, error) {
return &discord.Member{
User: discord.User{ID: userID},