Closed GenericNerd closed 2 years ago
This can be implemented using channels with goroutines and using a switch case there to check if the server is currently purging, perhaps a global map would be needed for ongoing jobs between guilds as storing this in mongo or redis would be painfully slow.
jobs[guild.id].Purge = make(chan struct{})
for foo {
switch {
case <- jobs[guild.id].Purge:
break
default:
}
// code here
}
then implement a command to cancel the purge by simply doing
func commandhandler() {
close(jobs[guild.id].Purge)
}
of course this wouldnt work as there are missing parameters and whatnot but its a proof of concept
i dont think this is possible because its one request... or is it?