Skip to content
Snippets Groups Projects
Commit 9b2fd36a authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add Block/Unblock to DM

parent 0606c450
No related branches found
No related tags found
1 merge request!109Project/haven beta
......@@ -63,6 +63,10 @@ func newDMClientJS(api *bindings.DMClient) map[string]any {
"SendReaction": js.FuncOf(cm.SendReaction),
"SendSilent": js.FuncOf(cm.SendSilent),
"Send": js.FuncOf(cm.Send),
// User Mute/Unmute
"BlockSender": js.FuncOf(cm.BlockSender),
"UnblockSender": js.FuncOf(cm.UnblockSender),
}
return dmClientMap
......@@ -572,6 +576,30 @@ func (dmc *DMClient) GetDatabaseName(js.Value, []js.Value) any {
"_speakeasy_dm"
}
// BlockSender blocks the provided sender public key from sending DMs
//
// Parameters:
// - args[0] - [ed25519.PublicKey] (Uint8Array)
//
// Returns nothing
func (dmc *DMClient) BlockSender(_ js.Value, args []js.Value) any {
senderKey := utils.CopyBytesToGo(args[0])
dmc.api.BlockSender(senderKey)
return nil
}
// UnblockSender unblocks the provided sender public key to allow sending DMs
//
// Parameters:
// - args[0] - [ed25519.PublicKey] (Uint8Array)
//
// Returns nothing
func (dmc *DMClient) UnblockSender(_ js.Value, args []js.Value) any {
senderKey := utils.CopyBytesToGo(args[0])
dmc.api.UnblockSender(senderKey)
return nil
}
////////////////////////////////////////////////////////////////////////////////
// DM Share URL //
////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment