core.channel#

class immp.core.channel.Channel(plug, source)#

Bases: object

Container class that holds a (Plug, str) pair representing a room inside the plug’s network.

plug#

Related plug instance where the channel resides.

Type:

.Plug

source#

Plug-specific channel identifier.

Type:

str

async is_private()#

Equivalent to Plug.channel_is_private().

Returns:

True if the channel is private; None if the service doesn’t have a notion of private channels.

Return type:

bool

async title()#

Equivalent to Plug.channel_title().

Returns:

Display name for the channel.

Return type:

str

Equivalent to Plug.channel_link().

Returns:

Internal deep link to this channel.

Return type:

str

async rename(title)#

Equivalent to Plug.channel_rename().

Parameters:

title (str) – New display name for the channel.

async members()#

Equivalent to Plug.channel_members().

Returns:

Members present in the channel.

Return type:

.User list

async admins()#

Equivalent to Plug.channel_admins().

Returns:

Members with admin privileges present in the channel.

Return type:

.User list

async invite_multi(users)#

Equivalent to Plug.channel_invite_multi().

Parameters:

users (.User list) – New users to invite.

async invite(user)#

Equivalent to Plug.channel_invite().

Parameters:

user (.User) – New user to invite.

async remove_multi(users)#

Equivalent to Plug.channel_remove_multi().

Parameters:

users (.User list) – Existing users to kick.

async remove(user)#

Equivalent to Plug.channel_remove().

Parameters:

user (.User) – Existing user to kick.

Equivalent to Plug.channel_link_create().

Parameters:

shared (bool) – True (default) for a common, unlimited-use, non-expiring link (subject to any limitations from the underlying network); False for a private, single-use link.

Equivalent to Plug.channel_link_revoke().

Parameters:

link (str) – Existing invite link to revoke.

async history(before=None)#

Equivalent to Plug.channel_history().

Parameters:

before (.Receipt) – Starting point message, or None to fetch the most recent.

Returns:

Messages from the channel, oldest first.

Return type:

.Receipt list

async send(msg)#

Push a message to the related plug on this channel. Equivalent to Plug.send().

Parameters:

msg (.Message) – Original message received from another channel or plug.

class immp.core.channel.Group(name, config, host)#

Bases: Configurable

Container of multiple channels.

Groups cannot be iterated, as they may hold any possible channel from a Plug, but you can test for membership of a given Channel using has().

A group is defined by a base list of channels, and/or lists of channel types from plugs. The latter may target private or shared (non-private) channels, named for host-defined channels, or anywhere as long as it belongs to the given plug.

class MergedProperty(key=None)#

Bases: ConfigProperty