Пример #1
0
 def channels_invites_create(self, channel, max_age=86400, max_uses=0, temporary=False, unique=False):
     r = self.http(Routes.CHANNELS_INVITES_CREATE, dict(channel=channel), json={
         'max_age': max_age,
         'max_uses': max_uses,
         'temporary': temporary,
         'unique': unique
     })
     return Invite.create(self.client, r.json())
Пример #2
0
    def create_invite(self, *args, **kwargs):
        """
        Attempts to create a new invite with the given arguments. For more
        information see `Invite.create_for_channel`.

        Returns
        -------
        `Invite`
        """

        from disco.types.invite import Invite
        return Invite.create_for_channel(self, *args, **kwargs)
Пример #3
0
    def test_create_channel_url(self):
        self.assertEqual(
            self.service.create_channel_url(DISCORD_GUILD_ID,
                                            1,
                                            is_audio=False),
            "https://discord.com/channels/11111/1",
        )

        invite = Invite(
            code="invite_code",
            max_age=0,
        )

        self.mock_client.channels_invites_create.return_value = invite
        self.assertEqual(
            self.service.create_channel_url(DISCORD_GUILD_ID, 2,
                                            is_audio=True),
            "https://discord.gg/invite_code",
        )
Пример #4
0
 def invites_delete(self, invite):
     r = self.http(Routes.INVITES_DELETE, dict(invite=invite))
     return Invite.create(self.client, r.json())
Пример #5
0
 def invites_get(self, invite):
     r = self.http(Routes.INVITES_GET, dict(invite=invite))
     return Invite.create(self.client, r.json())
Пример #6
0
 def channels_invites_list(self, channel):
     r = self.http(Routes.CHANNELS_INVITES_LIST, dict(channel=channel))
     return Invite.create_map(self.client, r.json())
Пример #7
0
 def invites_delete(self, invite, reason=None):
     r = self.http(Routes.INVITES_DELETE, dict(invite=invite), headers=_reason_header(reason))
     return Invite.create(self.client, r.json())
Пример #8
0
 def guilds_invites_list(self, guild):
     r = self.http(Routes.GUILDS_INVITES_LIST, dict(guild=guild))
     return Invite.create_map(self.client, r.json())
Пример #9
0
 def create_invite(self, *args, **kwargs):
     from disco.types.invite import Invite
     return Invite.create(self, *args, **kwargs)
Пример #10
0
 def invites_get(self, invite, with_counts=None):
     r = self.http(Routes.INVITES_GET, dict(invite=invite), params=optional(with_counts=with_counts))
     return Invite.create(self.client, r.json())