Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.02 KB

README.md

File metadata and controls

37 lines (26 loc) · 1.02 KB

Discord Log

A simple application that executes a time-consuming code block and sends a notification to a given Discord channel (or as direct message) with return value, execution time, and the code block that was executed.

This tool was implemented during a practical session of Pharo Club held after a tech talk by Juraj Kubelka: DiscordSt: API & Pharo Integration.

Dependencies

This application is based on DiscordSt. So you must first install it

Metacello new
   baseline: #DiscordSt;
   repository: 'github://JurajKubelka/DiscordSt:dev/src';
   load.

Example usage

url := 'https://discordapp.com/api/webhooks/<your webhook id>'.
log := PCDiscordLog withWebhook: url.

"Your time-consuming code"
block := [
   | factorials |
	
   factorials := (1 to: 1000) collect: [ :each |
      each factorial ].
	
   factorials takeFirst: 10
].

log timeItAndNotify: block.

Notification on Discord

Screenshot