Esempio n. 1
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('files:list');
        $this->setDescription('Returns a list of all files in your Slack team');
        $this->addOption('user-id', 'u', InputOption::VALUE_REQUIRED, 'Filter files created by a single user.');
        $this->addOption('from', null, InputOption::VALUE_REQUIRED, 'Filter files created after this timestamp (inclusive).');
        $this->addOption('to', null, InputOption::VALUE_REQUIRED, 'Filter files created before this timestamp (inclusive).');
        $this->addOption('types', null, InputOption::VALUE_REQUIRED, 'Filter files by type. You can pass multiple values in the types argument, like types=posts,snippets. The default value is all, which does not filter the list.');
        $this->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'Number of items to return per page.');
        $this->addOption('page', 'p', InputOption::VALUE_REQUIRED, 'Page number of results to return.');
        $this->setHelp(<<<EOT
The <info>files:list</info> command returns a list of files within the team.
It can be filtered and sliced in various ways.

The response contains a list of files, followed by some paging information.

- Files are always returned with the most recent first.
- Paging contains:
  - the count of files returned
  - the total number of files matching the filter(s) (if any were supplied)
  - the page of results returned in this response
  - the total number of pages available
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:create-child');
        $this->setDescription('This method creates a child group from an existing group (see `--help`)');
        $this->addArgument('group-id', InputArgument::REQUIRED, 'The name of the channel to create (must not exist already)');
        $this->setHelp(<<<EOT
The <info>groups:create-child</info> command takes an existing private group and performs the following steps:

- Renames the existing group (from "example" to "example-archived").
- Archives the existing group.
- Creates a new group with the name of the existing group.
- Adds all members of the existing group to the new group.

This is useful when inviting a new member to an existing group while hiding all previous chat history from them.
In this scenario you can run <info>groups.createChild</info> followed by <info>groups.invite</info>.

The new group will have a special `parent_group` property pointing to the original archived group.
This will only be returned for members of both groups, so will not be visible to any newly invited members.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.createChild</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('chat:post-message');
        $this->setAliases(['chat.postMessage']);
        $this->setDescription('Sends a message to a Slack channel of your choice');
        $this->addArgument('channel', InputArgument::REQUIRED, 'The channel to send the message to');
        $this->addArgument('text', InputArgument::REQUIRED, 'The text of the message to send');
        $this->addOption('username', 'u', InputOption::VALUE_REQUIRED, 'The username that will send this text (does not have to exist in your Team)');
        $this->addOption('icon-emoji', 'ie', InputOption::VALUE_REQUIRED, 'Emoji to use as the icon for this message. Overrides `--icon_url`.');
        $this->addOption('icon-url', 'iu', InputOption::VALUE_REQUIRED, 'URL to an image to use as the icon for this message');
        $this->addOption('parse', 'p', InputOption::VALUE_REQUIRED, 'Change how messages are treated. See information in `--help`');
        $this->addOption('link-names', 'l', InputOption::VALUE_REQUIRED, 'Set this flag to `true` to automatically link channel-names and usernames');
        $this->addOption('unfurl-links', 'ul', InputOption::VALUE_REQUIRED, 'Pass true to enable unfurling of primarily text-based content');
        $this->addOption('unfurl-media', 'um', InputOption::VALUE_REQUIRED, 'Pass false to disable unfurling of media content');
        $this->setHelp(<<<EOT
The <info>chat:post-message</info> command posts a message to a given channel.

Messages are formatted as described in the formatting spec (link below). You can specify values for `parse` and `link_names`
to change formatting behavior.

The optional attachments argument should contain a JSON-encoded array of attachments. For more information, see the
`attachments` spec (link below).

By default links to media are unfurled, but links to text content are not.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/chat.postMessage</comment>
EOT
);
    }
Esempio n. 4
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:mark');
        $this->setDescription('Moves the read cursor in a Slack group');
        $this->addArgument('group-id', InputArgument::REQUIRED, 'ID of the group to set reading cursor in.');
        $this->addArgument('timestamp', InputArgument::REQUIRED, 'Timestamp of the most recently seen message.');
        $this->setHelp(<<<EOT
The <info>groups.mark</info> command is used to move the read cursor in a Slack group.

After running this command, the mark is saved to the database and broadcast via the message server to all open connections
for the token's user.

You should try to avoid running this command too often. When needing to mark a read position, you should set a timer
before running the command. In this way, any further updates needed during the timeout will not generate extra calls
(just one per channel).

This is useful for when reading scroll-back history, or following a busy live channel. A timeout of 5 seconds is a good
starting point. Be sure to flush these calls on shutdown/logout.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.mark</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:history');
        $this->setDescription('Returns a portion of messages/events from the specified channel (see `--help`)');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'Channel to fetch history for');
        $this->addOption('latest', 'l', InputOption::VALUE_REQUIRED, 'Latest message timestamp to include in results');
        $this->addOption('oldest', 'o', InputOption::VALUE_REQUIRED, 'Oldest message timestamp to include in results');
        $this->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'Number of messages to return, between 1 and 1000.');
        $this->setHelp(<<<EOT
The <info>channels:history</info> command returns a portion of messages/events from the specified channel.
To read the entire history for a channel, run the command with no `latest` or `oldest` options, and then continue paging
using the instructions below.

The messages array up to 100 messages between `--latest` and `--oldest`. If there were more than 100 messages between
those two points, then has_more will be true.

If a message has the same timestamp as latest or oldest it will not be included in the list. This allows a client to fetch
all messages in a hole in channel history, by running the <info>channels.history</info> command with `--latest`
set to the oldest message they have after the hole, and `--oldest` to the latest message they have before the hole.
If the response includes `has_more` then the client can make another call, using the `ts` value of the final messages as
the latest param to get the next page of messages.

If there are more than 100 messages between the two timestamps then the messages returned are the ones closest to latest.
In most cases an application will want the most recent messages and will page backward from there. If oldest is provided
but not latest then the messages returned are those closest to oldest, allowing you to page forward through history if desired.

If either of the latest or oldest arguments are provided then those timestamps will also be included in the output.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.history</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('search:files');
        $this->setDescription('Searches files within your Slack team');
        $this->addArgument('query', InputArgument::REQUIRED, 'Search query. May contains booleans, etc.');
        $this->addOption('sort', null, InputOption::VALUE_REQUIRED, 'Return matches sorted by either score or timestamp');
        $this->addOption('sort-dir', null, InputOption::VALUE_REQUIRED, 'Change sort direction to ascending (asc) or descending (desc)');
        $this->addOption('highlight', null, InputOption::VALUE_REQUIRED, 'Pass a value of 1 to enable query highlight markers');
        $this->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'Number of items to return per page');
        $this->addOption('page', 'p', InputOption::VALUE_REQUIRED, 'Page number of results to return');
        $this->setHelp(<<<EOT
The <info>search:files</info> command allows you to search for files matching a given query

If the `--highlight` option is specified, the matching query terms will be marked up in the results so that clients may
replace them with appropriate highlighting markers (e.g. <span class="highlight"></span>).

The UTF-8 markers used are:
- start: ""; # U+E000 (private-use)
- end  : ""; # U+E001 (private-use)

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/search.files</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('files:upload');
        $this->setDescription('Create or upload an existing file to Slack');
        $this->addOption('path', 'p', InputOption::VALUE_REQUIRED, 'The path to the file to upload');
        $this->addOption('content', 'c', InputOption::VALUE_REQUIRED, 'The raw content of the file to upload (alternative for `--path`)');
        $this->addOption('filetype', 'ft', InputOption::VALUE_REQUIRED, 'Slack-internal file type identifier (e.g. `php`)');
        $this->addOption('filename', 'fn', InputOption::VALUE_REQUIRED, 'Filename of the file');
        $this->addOption('title', null, InputOption::VALUE_REQUIRED, 'Title of the file');
        $this->addOption('initial-comment', null, InputOption::VALUE_REQUIRED, 'Initial comment to add to the file');
        $this->addOption('channels', null, InputOption::VALUE_REQUIRED, 'Comma-separated list of channel IDs to share the file into');
        $this->setHelp(<<<EOT
The <info>files:upload</info> command allows you to create or upload an existing file.

The type of data in the file will be intuited from the filename and the magic bytes in the file, for supported formats.
Using the `--filetype` option will override this behavior (if a valid type is given).

The file can also be shared directly into channels on upload, by specifying the `--channels` option.
Channel IDs should be comma separated if there is more than one.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/files.upload</comment>
EOT
);
    }
Esempio n. 8
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('im:list');
        $this->setDescription('Returns a list of all IM channels in your Slack team');
        $this->addOption('exclude-archived', null, InputOption::VALUE_OPTIONAL, 'Don\'t return archived IM channels.');
        $this->setHelp(<<<EOT
The <info>im:list</info> command returns a list of all IM channels in your Slack team.
This includes channels the caller is in, channels they are not currently in, and archived channels.
The number of (non-deactivated) members in each channel is also returned.
EOT
);
    }
Esempio n. 9
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('users:list');
        $this->setDescription('Returns a list of all users in the team (including deleted/deactivated users)');
        $this->setHelp(<<<EOT
The <info>users:list</info> command returns a list of all users in the team. This includes deleted/deactivated users.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/users.list</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:create');
        $this->setDescription('Creates new Slack channel with the given name');
        $this->addArgument('name', InputArgument::REQUIRED, 'The name of the channel to create (must not exist already)');
        $this->setHelp(<<<EOT
The <info>channels:create</info> command let's you create a new Slack channel with the given name.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.create</comment>
EOT
);
    }
Esempio n. 11
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:leave');
        $this->setDescription('Leave a group (as the user of the token).');
        $this->addArgument('group-id', InputArgument::REQUIRED, 'The ID of the group to leave');
        $this->setHelp(<<<EOT
The <info>groups:leave</info> command leaves a group as the user of the token.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.leave</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('users:set-active');
        $this->setDescription('Lets the slack messaging server know that the token\'s user is currently active');
        $this->setHelp(<<<EOT
The <info>users:set-active</info> command lets the slack messaging server know that the token's
user is currently active. Consult the presence documentation for more details (see link below).

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/users.setActive</comment>
EOT
);
    }
Esempio n. 13
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:create');
        $this->setDescription('Creates a new Slack group with the given name');
        $this->addArgument('name', InputArgument::REQUIRED, 'The name of the private group to create');
        $this->setHelp(<<<EOT
The <info>groups:create</info> command let's you create a new Slack group.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.create</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:archive');
        $this->setDescription('Archives a given Slack channel');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel to archive');
        $this->setHelp(<<<EOT
The <info>channels:archive</info> command let's you archive a given Slack channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.archive</comment>
EOT
);
    }
Esempio n. 15
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('stars:list');
        $this->setDescription('Returns a list of all the items starred by a user');
        $this->addOption('user-id', null, InputOption::VALUE_REQUIRED, 'Show stars by this user. Defaults to the token\'s user.');
        $this->setHelp(<<<EOT
The <info>stars:list</info> returns a list of all the items starred by a user.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/stars.list</comment>
EOT
);
    }
Esempio n. 16
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:open');
        $this->setDescription('Opens a given Slack group');
        $this->addArgument('group-id', InputArgument::REQUIRED, 'The ID of a private group to open');
        $this->setHelp(<<<EOT
The <info>groups.open</info> command let's you open a given Slack group.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.open</comment>
EOT
);
    }
Esempio n. 17
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('im:close');
        $this->setDescription('Closes a given Slack IM channel');
        $this->addArgument('im-id', InputArgument::REQUIRED, 'The ID of an IM channel to close');
        $this->setHelp(<<<EOT
The <info>im:close</info> command let's you close a IM channel

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/im.close</comment>
EOT
);
    }
Esempio n. 18
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:info');
        $this->setDescription('Returns information about a team channel.');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel to get information on');
        $this->setHelp(<<<EOT
The <info>channels:info</info> command returns information about a given channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.info</comment>
EOT
);
    }
Esempio n. 19
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('im:open');
        $this->setDescription('Opens a Slack IM channel with another user');
        $this->addArgument('user-id', InputArgument::REQUIRED, 'ID of the user to open a direct message channel with');
        $this->setHelp(<<<EOT
The <info>im:open</info> command let's you open a Slack IM channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/im.open</comment>
EOT
);
    }
Esempio n. 20
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('users:info');
        $this->setDescription('Returns information about a team member');
        $this->addArgument('user-id', InputArgument::REQUIRED, 'User to get info on');
        $this->setHelp(<<<EOT
The <info>users.info</info> command returns information about a team member.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/users.info</comment>
EOT
);
    }
Esempio n. 21
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:kick');
        $this->setDescription('Removes (kicks) a given user from a group');
        $this->addArgument('group-id', InputArgument::REQUIRED, 'The ID of the group to remove the user from');
        $this->addArgument('user-id', InputArgument::REQUIRED, 'The ID of the user to remove');
        $this->setHelp(<<<EOT
The <info>groups:kick</info> command allows you to remove another member from a grouo.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.kick</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('users:set-presence');
        $this->setDescription('Override the token user\'s presence value');
        $this->addArgument('presence', InputArgument::REQUIRED, 'Either "active" or "away"');
        $this->setHelp(<<<EOT
The <info>users:set-presence</info> command lets you manually override the token user's presence value.
Consult the presence documentation for more details.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/presence.set</comment>
EOT
);
    }
Esempio n. 23
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('auth:test');
        $this->setDescription('Test authentication with the Slack API and, optionally, tells you who you are (use -v).');
        $this->setHelp(<<<EOT
The <info>auth:test</info> command lets you test authenticating with the Slack API.

Use the verbose option `-v` to also return information about the token's user.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/auth.test</comment>
EOT
);
    }
Esempio n. 24
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:list');
        $this->setDescription('Returns a list of all groups in your Slack team');
        $this->addOption('exclude-archived', null, InputOption::VALUE_OPTIONAL, 'Don\'t return archived groups.');
        $this->setHelp(<<<EOT
This method returns a list of groups in the team that the caller is in and archived groups that the caller was in.
The list of (non-deactivated) members in each group is also returned.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.list</comment>
EOT
);
    }
Esempio n. 25
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('chat:delete');
        $this->setDescription('Deletes a message from a given channel');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel containing the message to be deleted');
        $this->addArgument('timestamp', InputArgument::REQUIRED, 'Timestamp of the message to be deleted');
        $this->setHelp(<<<EOT
The <info>chat:delete</info> command deletes a message from a given channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/chat.delete</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:unarchive');
        $this->setDescription('Unarchives a channel. The token\'s user is automatically added to the channel');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel to archive');
        $this->setHelp(<<<EOT
The <info>channels:unarchive</info> command unarchives a given channel.
The user of the token is automatically added to the channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.unarchive</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('groups:set-topic');
        $this->setDescription('Change the topic of a group. The calling user must be a member of the group.');
        $this->addArgument('group-id', InputArgument::REQUIRED, 'The ID of the group to change the topic of');
        $this->addArgument('topic', InputArgument::REQUIRED, 'The new topic');
        $this->setHelp(<<<EOT
The <info>groups:set-topic</info> command changes the topic of a group.
The calling user must be a member of the group.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/groups.setTopic</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:set-purpose');
        $this->setDescription('Change the purpose of a channel. The calling user must be a member of the channel.');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel to change the purpose of');
        $this->addArgument('purpose', InputArgument::REQUIRED, 'The new purpose');
        $this->setHelp(<<<EOT
The <info>channels:set-purpose</info> command changes the purpose of a channel.
The calling user must be a member of the channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.setPurpose</comment>
EOT
);
    }
Esempio n. 29
0
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:list');
        $this->setDescription('Returns a list of all channels in your Slack team');
        $this->addOption('exclude-archived', null, InputOption::VALUE_OPTIONAL, 'Don\'t return archived channels.');
        $this->setHelp(<<<EOT
The <info>channels:list</info> command returns a list of all channels in your Slack team.
This includes channels the caller is in, channels they are not currently in, and archived channels.
The number of (non-deactivated) members in each channel is also returned.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.list</comment>
EOT
);
    }
    /**
     * {@inheritDoc}
     */
    protected function configure()
    {
        parent::configure();
        $this->setName('channels:invite');
        $this->setDescription('Invites a user to a channel. The calling user must be a member of the channel.');
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel to invite the user to');
        $this->addArgument('user-id', InputArgument::REQUIRED, 'The ID of the user to invite');
        $this->setHelp(<<<EOT
The <info>channels.invite</info> command is used to invite a user to a channel.
The calling user must be a member of the channel.

For more information about the related API method, check out the official documentation:
<comment>https://api.slack.com/methods/channels.invite</comment>
EOT
);
    }