Filter
uncanny-automator
automator_discord_invite_tokens
Filters Discord invite tokens, allowing modification of invite URL, server name, channel name, and site name.
add_filter( 'automator_discord_invite_tokens', $callback, 10, 1 );
Description
Filters the available tokens for Discord invite actions. Developers can add custom tokens or modify existing ones like invite URL, server, and channel names before they are used in automations. This allows for dynamic content generation in Discord invite messages.
Usage
add_filter( 'automator_discord_invite_tokens', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
// Add a new token for the site URL to the Discord invite tokens.
add_filter(
'automator_discord_invite_tokens',
function ( $tokens ) {
$tokens[] = '{{site_url}}';
return $tokens;
},
10,
1
); // Priority 10, accepts 1 argument
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/discord/actions/discord-invite-member-to-server.php:85
* Define options
*
* @return array
*/
public function options() {
// Replaceable codes for email body.
$available_codes = apply_filters(
'automator_discord_invite_tokens',
array(
'{{invite_url}}',
'{{server_name}}',
'{{channel_name}}',
'{{site_name}}',
)