Skip to content

Examples of using Discord webhooks and bots in Pharo

Notifications You must be signed in to change notification settings

PharoClub/DiscordExamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

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

About

Examples of using Discord webhooks and bots in Pharo

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published