mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-22 00:13:01 +00:00
Add support for bot integrations
This commit is contained in:
@@ -45,7 +45,7 @@ from .iterators import AuditLogIterator, MemberIterator
|
||||
from .widget import Widget
|
||||
from .asset import Asset
|
||||
from .flags import SystemChannelFlags
|
||||
from .integrations import Integration
|
||||
from .integrations import BotIntegration, StreamIntegration, _integration_factory
|
||||
|
||||
__all__ = (
|
||||
'Guild',
|
||||
@@ -1803,7 +1803,14 @@ class Guild(Hashable):
|
||||
The list of integrations that are attached to the guild.
|
||||
"""
|
||||
data = await self._state.http.get_all_integrations(self.id)
|
||||
return [Integration(guild=self, data=d) for d in data]
|
||||
|
||||
def convert(d):
|
||||
factory, itype = _integration_factory(d['type'])
|
||||
if factory is None:
|
||||
raise InvalidData('Unknown integration type {type!r} for integration ID {id}'.format_map(d))
|
||||
return factory(guild=self, data=d)
|
||||
|
||||
return [convert(d) for d in data]
|
||||
|
||||
async def fetch_emojis(self):
|
||||
r"""|coro|
|
||||
|
Reference in New Issue
Block a user