init
This commit is contained in:
@@ -32,6 +32,21 @@ class SlackBot:
|
||||
|
||||
return
|
||||
|
||||
def sendMsg(self, msg):
|
||||
try:
|
||||
this_time = datetime.now()
|
||||
text = "DATE TIME:" + this_time.strftime('%Y-%m-%d %H:%M:%S') + ", " + "msg:" + msg
|
||||
result = self.client.chat_postMessage(
|
||||
channel=self.CHANNEL_ID,
|
||||
text=text
|
||||
)
|
||||
print(text)
|
||||
|
||||
except SlackApiError as e:
|
||||
print(f"Error posting message: {e}")
|
||||
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
this_time = datetime.now()
|
||||
|
||||
Reference in New Issue
Block a user