# Module `irc.channel`

This module implements a channel object representing a single channel we have joined.

## Functions

ban (self, name) | Ban a user from a channel.
contains (self, nick) | Test if a user is in the channel.
deop (self, name) | Remove ops from a user.
devoice (self, name) | Remove voice from a user.
each_member (self) | Iterator over all users in the channel
each_op (self) | Iterator over the ops in the channel
each_user (self) | Iterator over the normal users in the channel
each_voice (self) | Iterator over the voiced users in the channel
members (self) | Gets an array of all the users in the channel.
new (chan) | Creates a new Channel object.
op (self, name) | Give a user ops on a channel.
ops (self) | Gets an array of all the ops in the channel.
set_invite_only (self, set) | Set whether joining the channel requires an invite.
set_key (self, key) | Set a channel password.
set_limit (self, new_limit) | Set a channel limit.
set_moderated (self, set) | Set whether voice is required to speak.
set_no_outside_messages (self, set) | If true, users must be in the channel to send messages to it.
set_private (self, set) | Set the private state of a channel.
set_secret (self, set) | Set the secret state of a channel.
set_topic_lock (self, set) | If true, the topic can only be changed by an op.
unban (self, name) | Remove a ban on a user.
users (self) | Gets an array of all the normal users in the channel.
voice (self, name) | Give a user voice on a channel.
voices (self) | Gets an array of all the voiced users in the channel.

## Tables

Channel | An object of the Channel class represents a single joined channel.

## Functions

ban (self, name)
  Ban a user from a channel.

  ### Parameters

  - self: Channel object
  - name: User to ban
contains (self, nick)
  Test if a user is in the channel.

  ### Parameters

  - self: Channel object
  - nick: Nick to search for

  ### Return value:

  True if the nick is in the channel, false otherwise
deop (self, name)
  Remove ops from a user.

  ### Parameters

  - self: Channel object
  - name: User to remove ops from
devoice (self, name)
  Remove voice from a user.

  ### Parameters

  - self: Channel object
  - name: User to remove voice from
each_member (self)
  Iterator over all users in the channel

  ### Parameters

  - self: Channel object
each_op (self)
  Iterator over the ops in the channel

  ### Parameters

  - self: Channel object
each_user (self)
  Iterator over the normal users in the channel

  ### Parameters

  - self: Channel object
each_voice (self)
  Iterator over the voiced users in the channel

  ### Parameters

  - self: Channel object
members (self)
  Gets an array of all the users in the channel.

  ### Parameters

  - self: Channel object

  ### Return value:

  Array of channel users
new (chan)
  Creates a new Channel object.

  ### Parameters

  - chan: Name of the new channel

  ### Return value:

  The new channel instance
op (self, name)
  Give a user ops on a channel.

  ### Parameters

  - self: Channel object
  - name: User to op
ops (self)
  Gets an array of all the ops in the channel.

  ### Parameters

  - self: Channel object

  ### Return value:

  Array of channel ops
set_invite_only (self, set)
  Set whether joining the channel requires an invite.

  ### Parameters

  - self: Channel object
  - set: True to set the channel invite only, false to unset it
set_key (self, key)
  Set a channel password.

  ### Parameters

  - self: Channel object
  - key: New channel password (optional; password is unset if this argument isn't passed)
set_limit (self, new_limit)
  Set a channel limit.

  ### Parameters

  - self: Channel object
  - new_limit: New value for the channel limit (optional; limit is unset if this argument isn't passed)
set_moderated (self, set)
  Set whether voice is required to speak.

  ### Parameters

  - self: Channel object
  - set: True to set the channel as moderated, false to unset it
set_no_outside_messages (self, set)
  If true, users must be in the channel to send messages to it.

  ### Parameters

  - self: Channel object
  - set: True to require users to be in the channel to send messages to it, false to remove this restriction
set_private (self, set)
  Set the private state of a channel.

  ### Parameters

  - self: Channel object
  - set: True to set the channel as private, false to unset it
set_secret (self, set)
  Set the secret state of a channel.

  ### Parameters

  - self: Channel object
  - set: True to set the channel as secret, false to unset it
set_topic_lock (self, set)
  If true, the topic can only be changed by an op.

  ### Parameters

  - self: Channel object
  - set: True to lock the topic, false to unlock it
unban (self, name)
  Remove a ban on a user.

  ### Parameters

  - self: Channel object
  - name: User to unban
users (self)
  Gets an array of all the normal users in the channel.

  ### Parameters

  - self: Channel object

  ### Return value:

  Array of channel normal users
voice (self, name)
  Give a user voice on a channel.

  ### Parameters

  - self: Channel object
  - name: User to give voice to
voices (self)
  Gets an array of all the voiced users in the channel.

  ### Parameters

  - self: Channel object

  ### Return value:

  Array of channel voiced users

## Tables

Channel
  An object of the Channel class represents a single joined channel. It has several table fields, and can be used in string contexts (returning the channel name).
  Fields
  - name: Name of the channel (read only)
  - topic: Channel topic, if set (read/write, writing to this sends a topic change request to the server for this channel)
  - chanmode: Channel mode (public/private/secret) (read only)
  - members: Array of all members of this channel