aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
Commit message (Collapse)AuthorAgeFilesLines
* Refactor unfurl_refs to use re.subTrygve Aaberge2019-08-251-36/+31
| | | | | Instead of finding each match and calling replace on the text with that match, use re.sub to replace all the matches.
* Include @channel, @everyone and @here in usergroup completionTrygve Aaberge2019-08-251-2/+3
| | | | | | | | @group isn't mentioned in the documentation[0], and is changed to @channel if you try to complete it in the web client, so it probably shouldn't be used anymore. [0]: https://get.slack.help/hc/en-us/articles/202009646-Notify-a-channel-or-workspace
* Render group notifications with @ instead of !Trygve Aaberge2019-08-251-2/+4
| | | | | | | | | This is for the notifications @channel, @everyone, @group and @here. @group isn't mentioned in the documentation[0], but it is still rendered as a highlight in the web client, so I included it. [0]: https://get.slack.help/hc/en-us/articles/202009646-Notify-a-channel-or-workspace
* Print error in /part command when channel is not foundTrygve Aaberge2019-08-251-0/+2
|
* Include channel prefix in key in get_channel_mapTrygve Aaberge2019-08-251-7/+7
| | | | Fixes #587
* Include @ in subteam handleTrygve Aaberge2019-08-251-17/+15
| | | | Subteams/usergroups should never be used without the @.
* Extract printing user/channel info to a shared functionTrygve Aaberge2019-08-251-22/+22
|
* Show handle when listing usergroup membersTrygve Aaberge2019-08-251-2/+2
|
* Show member status in /slack channels commandTrygve Aaberge2019-08-251-1/+7
|
* Use name instead of slack_name in /slack channels commandTrygve Aaberge2019-08-251-2/+2
| | | | This includes the prefix that shows the channel type.
* Support nicks prefixed with @ in /msg commandTrygve Aaberge2019-08-241-1/+1
|
* Don't add deleted users to tab completionTrygve Aaberge2019-08-071-1/+1
| | | | Fixes #703
* Add option to only use full namesTrygve Aaberge2019-08-071-1/+10
| | | | Fixes #100
* Fallback to full name if display name is not setTrygve Aaberge2019-08-071-1/+1
| | | | | | | The username can't be changed by the users themselves now and is auto generated for new users, so we shouldn't use it. Only use username as a last resort if neither display name nor full name is set (I'm not sure this ever happens, it looks like the full name field is mandatory).
* Fix attachment fields without titlesDavid Vo2019-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | Attachment fields are not guaranteed to have a title at all. This fixes in particular slackbot app approval messages, with an attachment like so: { "callback_id": "whitelist_A11BCGM0E_181389840855", "fields": [ { "short": true, "value": ":white_check_mark: *<@U4RPXA42F|davo> approved this app for the team.*" } ], "fallback": "Approve or deny the application", "id": 4, "color": "#2ab27b" }
* Set localvar_set_server for thread buffersTrygve Aaberge2019-06-201-0/+1
|
* Expose more information in /whois (#700)David Vo2019-06-151-3/+14
| | | Also hide any unset fields.
* Ignore away command run on non-slack buffers without -allTrygve Aaberge2019-06-141-1/+3
| | | | | This prevents printing an error when running /away without -all on buffers other than slack buffers.
* Sort nicks in mpdm name alphabeticallyTrygve Aaberge2019-06-121-2/+2
|
* Don't include own nick in mpdm namesTrygve Aaberge2019-06-121-3/+4
|
* Support topic changes for private channelsTrygve Aaberge2019-06-121-9/+10
| | | | Fixes #697
* Remove log* tags when using no_logTrygve Aaberge2019-06-111-8/+7
| | | | | When including both a log tag and a no_log tag, the message may be logged.
* new_messages should not be set for backlog messages, but for self_msgsTrygve Aaberge2019-06-111-3/+3
| | | | | | | | There are scenarios where last_read isn't set, and only self messages are printed. I experienced it when the only message in the channel was me joining and renaming the channel. In that case, last_read were never set, so we should set new_messages for our own messages so last_read will be set.
* Prevent logging of historic join/leave/topic messagesTrygve Aaberge2019-06-111-13/+10
| | | | | | Commit 79c825d changed logging so only historic messages are prevented from being logged, but join/leave/topic messages were not marked as historic, so they were always logged.
* Prevent websocket-client from importing and using numpyTrygve Aaberge2019-06-071-0/+5
| | | | | | | | | | | | | | | | This prevents a crash when you reload the script when using python 3 if numpy is installed. When weechat unloads a script it calls Py_Finalize, and when it loads a script, it calls Py_Initialize. If numpy is imported, this causes python to segfault, which crashes weechat. By setting numpy in sys.modules to None, it won't be imported when websocket-client tries to import it. numpy is an optional dependency of websocket-client, and if it's not installed, it will set numpy to None itself, so therefore, this should work just like when numpy isn't installed. See https://github.com/numpy/numpy/issues/11925 for more details about the issue in numpy.
* Get the word that is being completed the proper wayTrygve Aaberge2019-06-061-4/+4
| | | | | | Simplify emoji_completion_cb by using hook_completion_get_string to get the string that is being completed, instead of reading it out from the contents of the input.
* Add missing formatting placeholders in register_callbackTrygve Aaberge2019-06-041-2/+2
|
* Print specific error when rtm requests failsTrygve Aaberge2019-06-041-2/+2
|
* Use weechat.string_eval_path_home to eval files_download_locationTrygve Aaberge2019-06-041-1/+1
| | | | | This expands %h for us, so we don't have to do it ourselves. It also expands ~ and eval expressions.
* Resolve relative paths for upload commandTrygve Aaberge2019-06-041-1/+2
| | | | | | | The tab completion for the upload command tab completes paths relative to weechat_dir, not the directory weechat was started from. Resolve the path given to the upload command to that directory, so tab completed relative paths work.
* Remove escape characters from path if file is not foundTrygve Aaberge2019-06-041-2/+6
| | | | | | | | | | | | Some terminals (at least Terminal.app and iTerm2) escape spaces in the path when you drop a file in it. However, weechats tab completion does not escape them, so we can't just remove the escape characters, in case a user is trying to upload a file which has a name that contains "\ ". Therefore, first check if the file exists, and then remove escapes if it doesn't, and check if the unescaped name exists. Fixes #360
* Add error handling for /slack uploadTrygve Aaberge2019-06-041-1/+30
|
* Use hook_process_hashtable for uploading filesTrygve Aaberge2019-06-041-15/+16
| | | | | | | | | | | | | | Instead of creating a space separated string of the arguments for curl, create a dict and use hook_process_hashtable. The benefit of this is that we don't need to escape the spaces in the file name. This also utilizes SlackRequest to create the url we post to, so we don't have to hard code the url in this function. I tried to use hook_process_hashtable to request the url directly, instead of calling the curl command, but I didn't manage to make it upload the file in a format accepted by Slack. I opened an issue to weechat about it: https://github.com/weechat/weechat/issues/1352
* Don't use a dict as a default parameter in SlackRequestTrygve Aaberge2019-06-041-1/+3
| | | | | | The default values are created when the function is created, so when it's mutated, the default value is mutated. Create a new dict each time the function is called instead.
* Prevent crash when having mpdm with an external userTrygve Aaberge2019-06-041-1/+4
| | | | | | Fallback to the id when the user isn't known, like we do for SlackDMChannels. As a next step, we should look up the missing users and update the name, like we do for SlackDMChannels.
* Only prevent logging of messages from history requestTrygve Aaberge2019-06-031-15/+23
| | | | | | | | | | | | | | Preventing logging of all backlog messages meant that messages you sent from other clients wouldn't be logged, even if wee-slack was running. Additionally, there's an existing bug which sometimes causes the messages you send in wee-slack to be marked as backlog messages, so those wouldn't be logged either. Instead, only prevent logging of messages from the history request, since we always want to log new messages arriving over the websocket. It's still only backlog messages which are not logged, so messages which arrive when wee-slack isn't running will be logged (as long as you don't read them in another client before starting wee-slack).
* Check if channel is mpim by using is_mpim attributeTrygve Aaberge2019-06-031-1/+1
| | | | | Haven't run into issues regarding this, but using the attribute instead of the name is probably less likely to break in the future.
* Add current team and channel first in channel completionTrygve Aaberge2019-06-031-2/+15
| | | | This is the same as what the irc plugin does.
* Separate completion for irc_channels and irc_privatesTrygve Aaberge2019-06-031-1/+14
| | | | | irc_channels should only complete channels, not dms. A separate completion, irc_privates, completes dms.
* Allow completion of emoji with a prefixTrygve Aaberge2019-06-021-1/+6
| | | | Fixes #580
* Add completion for all command argumentsTrygve Aaberge2019-06-021-7/+61
|
* Unfurl and linkify in topic commandTrygve Aaberge2019-06-021-10/+15
|
* Add completion for channel namesTrygve Aaberge2019-06-021-0/+14
| | | | Fixes #235
* Print status in whois when either emoji or text is setTrygve Aaberge2019-06-021-4/+5
| | | | Previously, it was only printed if the status text was set.
* Support printing status with /slack status commandTrygve Aaberge2019-06-021-6/+13
| | | | | | | Now prints the status if no arguments are given. To unset the status, pass the argument -delete. Fixes #574
* Print error when profile/status couldn't be setTrygve Aaberge2019-06-021-0/+6
|
* Print error when a command is not used on an appropriate bufferTrygve Aaberge2019-06-021-0/+2
|
* Use proper nicks for mpdm namesTrygve Aaberge2019-06-021-17/+11
|
* Set own nick to display name if setTrygve Aaberge2019-06-021-8/+14
| | | | | | Previously, own nick would always be set to the username. Fixes #692
* Set tag thread_message on thread messages printed in channelsTrygve Aaberge2019-06-021-4/+10
|