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

.Plug – Related plug instance where the channel resides.

source

str – Plug-specific channel identifier.

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
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
rename(title)

Equivalent to Plug.channel_rename().

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

Equivalent to Plug.channel_members().

Returns
Members present in the channel.
Return type
User list
invite(user)

Equivalent to Plug.channel_invite().

Parameters
user (User) – New user to invite.
remove(user)

Equivalent to Plug.channel_remove().

Parameters
user (User) – Existing user to kick.
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
send(msg)

Push a message object to the related plug on this channel.

Parameters
msg (Message) – Original message received from another channel or plug.
class immp.core.channel.Group(name, config, host)

Bases: immp.core.util.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.