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

                                  
                           
 

              
                                                          

 
                                                                                 


                                                       



                                                                    
from __future__ import annotations

from typing import Callable

import weechat

from slack.shared import WeechatCallbackReturnType, shared


def get_callback_name(callback: Callable[..., WeechatCallbackReturnType]) -> str:
    callback_id = f"{callback.__name__}-{id(callback)}"
    shared.weechat_callbacks[callback_id] = callback
    return callback_id


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