aboutsummaryrefslogblamecommitdiffstats
path: root/slack/util.py
blob: b5b5bb20443b409d9215eb72429f2591c409dd86 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                  
                                        
 

              
                               
 
                                                                    
 

                                                                                    
                                                          
                            



                                                                    
from __future__ import annotations

from typing import Callable, Dict, Union

import weechat

from slack.shared import shared

weechat_callback_return_type = Union[int, str, Dict[str, str], None]


def get_callback_name(callback: Callable[..., weechat_callback_return_type]) -> str:
    shared.weechat_callbacks[callback.__name__] = callback
    return callback.__name__


def with_color(color: str, string: str):
    return f"{weechat.color(color)}{string}{weechat.color('reset')}"