aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remember plugin config values in FakeWeechatSamuel Holland2019-04-081-3/+4
| | | | | | PluginConfig uses round-tripping through wee_slack.w to coerce the its default values to the correct type. Without this, the normal getters fail, as '' cannot be converted to an integer/boolean.
* Make SHA1 hashing work on both Python 2 and 3Samuel Holland2019-04-081-5/+7
| | | | | Use sha1 from the hashlib module, and factor out a helper function that makes sure the argument to sha1 is a bytestring.
* Import urllib classes in a way compatible with Python 3Samuel Holland2019-04-081-2/+6
| | | | Try both the old and the new locations.
* Use StringIO from ioTrygve Aaberge2019-04-082-4/+3
| | | | | This is compatible with python 3, which StringIO from StringIO or cStringIO is not.
* Import print_function and unicode_literals in all test filesTrygve Aaberge2019-04-0824-15/+34
|
* Always use the print function from Python 3Samuel Holland2019-04-0814-62/+84
| | | | Comments are updated as well as live code.
* Don't serialize request metadataTrygve Aaberge2019-04-082-28/+17
| | | | | It seems pointless to serialize request metadata first with pickle, then pack it into json, just to unpack both afterwards.
* Delete useless testTrygve Aaberge2019-04-081-54/+0
| | | | | This test doesn't do any assertions, and is as far as I can see completely useless.
* Add @user-groups support (#680)Nana Amfo2019-04-089-10/+287
| | | Add @user-groups with tab-completion. @user-groups will be unfurl into format <!subteam^{ID}|handle> message before sending message via linktext method.
* Inform about retry limit in failed connection messageTrygve Aaberge2019-04-041-3/+5
| | | | | | If wee-slack has tried to connect too many times, it will give up. Inform about this in the error message, instead of keep saying that it will try to reconnect.
* Remove channel parameter from linkify_textTrygve Aaberge2019-04-032-18/+11
| | | | This parameter is not used in the function.
* Keep text directly after @channel/group/here when linkifyingTrygve Aaberge2019-04-022-1/+17
| | | | Previously, when writing e.g. `@channel: test` the colon would be lost.
* Sort options when generating Options.mdTrygve Aaberge2019-04-023-84/+91
|
* Implement -all parameter for /away commandTrygve Aaberge2019-03-261-5/+10
| | | | | | Away/back will be set for all slack teams if -all is used. Closes #596
* Improve detection of incoming formatting charactersTrygve Aaberge2019-03-261-6/+8
| | | | | | | | | | This replaces the trailing whitespace match with a non-consuming lookahead so that strings like '*one* *two*' match correctly, and uses \w instead of hard coded ascii characters. This is taken from #359 and updated. Closes #359
* Correctly handle group join/leave eventsDavid Vo2019-03-261-1/+5
|
* Upload file to thread instead of channel when in thread bufferEric Wang2019-03-261-2/+12
| | | | | | | | Currently files are always uploaded to the main channel, even when `/slack upload` is run in a thread buffer. This happens because the `thread_ts` field isn't included in the upload request. Fixes #672
* Ping websocket connection every five secondsTrygve Aaberge2019-03-131-1/+10
| | | | | | | | | | | | | | | | | | | | | Thanks to @celsworth and @micolous for pointing out that Slack now requires this for some teams. From https://github.com/slackapi/python-slackclient/issues/118#issuecomment-348731791: I've observed that some Slack teams have (recently) been opted into an experiment (by SlackHQ) which requires that ping messages are sent by RTM clients, otherwise they will be disconnected after 2-3 minutes. This is more frequently than the other reporters, and has only become an issue in the last 4 days for me. However, this experiment has only been applied to a limited number of teams (I see only one team with the issue and all others without, even when running the same bot code), which don't appear to correlate with age of the team. May partly fix #679, but that seems to also be caused by an issue in websocket-client.
* Check if user exists before updating statusTrygve Aaberge2019-03-051-4/+6
| | | | | | The team may have external users (i.e. guests or users from other teams), which we don't store in the team user list, so ignore status updates for those.
* Add ability to open last thread in channel without specifying message idTomas Varneckas2019-02-232-8/+21
|
* Decode formatted exceptions from utf8Trygve Aaberge2019-02-191-11/+20
| | | | | | | | | Trying to concat exceptions containing non-ascii chars with our own message failed with a UnicodeDecodeError. We have to decode them to unicode strings first. This includes some helper methods for that, one which includes the traceback, and one which only has the error. Fixes #593
* Only print one line after connecting to a teamTrygve Aaberge2019-02-151-8/+2
|
* Move message handling out of exception handlingTrygve Aaberge2019-02-151-12/+10
| | | | | | | | | | Remove handling of all exceptions. If an unknown exception happens, it's better to just let it print a stack trace to the core buffer so we notice it, instead of just printing it in the debug buffer. The two specific exceptions we handle are just necessary for the recv call, so we can move the rest of the lines outside of the exception handling.
* Print more useful error and debug messages on connection failureTrygve Aaberge2019-02-151-7/+17
|
* Disconnect when sending to websocket failsTrygve Aaberge2019-02-151-3/+1
| | | | | | If sending to the websocket fails, it is most likely down and we'll have to reconnect. By disconnecting, the reconnect timer will ensure we reconnect.
* Retry rtm.start if it failsTrygve Aaberge2019-02-151-0/+7
| | | | | | | If you're connecting to multiple teams, especially if one of them is large, the call to rtm.start may time out. By retrying it, there's a greater chance that it works (especially since when it tries again, the requests to rtm.start for the other teams have probably finished).
* Print connecting message on startTrygve Aaberge2019-02-151-0/+2
|
* Fix 'slackbot' name change to 'Slackbot' breaking never_awayV13Axel2019-02-151-1/+1
|
* Fix /slack linkarchive command because of an API changePásztor János2019-02-151-1/+1
| | | | * for details please see: https://api.slack.com/methods/chat.getPermalink
* Name files sequentially, don't download historicalDaniel Lublin2019-02-151-14/+40
| | | | Closes #562
* Add option to download files locallyJosip Janzic2019-02-151-0/+20
| | | | Useful when running wee-slack without a open session in a browser/app.
* Don't override server_aliases with short_buffer_namesTrygve Aaberge2019-01-271-9/+7
| | | | | | | There's no reason to not use the server aliases even when short_buffer_names is on. Now, it will use server aliases for the servers that has it defined, and short names for the rest if short_buffer_names is on.
* Print a message when another client/the server closes an IMTrygve Aaberge2019-01-271-3/+5
|
* Delete buffer from our own list before closing itTrygve Aaberge2019-01-271-22/+13
| | | | | | | | | | | | | | When we close a buffer, weechat invokes a callback so we can unregister the channel. However, when we close the buffer ourselves in the unregister function it caused the unregister function to be called again. By deleting the buffer from our list first, the second invokation of unregister won't find the channel, so the rest isn't run again. This prevents an error from weechat when we sent None into buffer_clear because the channel_buffer had already been set to None. Also does some cleanup. Use global EVENTROUTER, check if channel exists instead of catching exception and remove some unnecessary checks.
* Generate documentation for commands and optionsTrygve Aaberge2019-01-264-4/+461
|
* Print error if no args given to slack talk/join/queryTrygve Aaberge2019-01-261-1/+9
|
* Print error if channel or user is not foundTrygve Aaberge2019-01-261-19/+21
| | | | Fixes #597
* Remove some commented out and unnecessary linesTrygve Aaberge2019-01-261-23/+9
|
* Update readmeTrygve Aaberge2019-01-261-122/+33
| | | | | Instead of duplicating much of the documentation for commands and options, refer to the /set and /help commands in weechat.
* Simplify code for distracting channelsTrygve Aaberge2019-01-261-21/+9
|
* Rename command callbacks to start with command_Trygve Aaberge2019-01-261-8/+7
| | | | | This includes these commands in the help command. It also allows these commands to be used with the /slack prefix.
* Simplify slack_command_cb and commandsTrygve Aaberge2019-01-261-70/+73
| | | | | Don't send in the command name as part of args. This removes the need for removing the name from args.
* Add custom commands properlyTrygve Aaberge2019-01-261-25/+27
| | | | | | | | | We should use hook_command instead of hook_command_run when we add new custom commands because this will include completion and help for the command. When we use this, the command name won't be included in the arguments, which is why the usage of args in the functions has changed.
* Add docstrings/help for all commandsTrygve Aaberge2019-01-261-7/+70
|
* Merge linkarchive and openweb commandsTrygve Aaberge2019-01-261-21/+22
| | | | | | linkarchive now supports being run without arguments, and if so it will output a link to either the team or the channel, depending on where it's run. openweb has been removed.
* Rename register command callbackTrygve Aaberge2019-01-261-2/+3
| | | | | | When the command starts with command_, it will be listed in the help and callable with /slack. This is just a callback function, so it should not be callable directly by the user.
* Remove command_pTrygve Aaberge2019-01-261-4/+0
| | | | | This is a command meant for debugging and shouldn't be normally available and listed in the help.
* Remove /leave commandTrygve Aaberge2019-01-261-2/+0
| | | | | /leave is by default aliased to /part. We don't have to specify this in wee-slack.
* Add /slack help commandTrygve Aaberge2019-01-261-4/+26
| | | | Fixes #363
* Simplify setting topic from topic or purposeTrygve Aaberge2019-01-261-3/+1
|