poshbotio / PoshBot

Powershell-based bot framework
MIT License
539 stars 108 forks source link

Commands exectuted twice. #145

Closed mgeorgebrown89 closed 4 years ago

mgeorgebrown89 commented 5 years ago

I created a function to respond to new users joining a channel based on the documentation.

function Welcome-User {
[PoshBot.BotCommand(
    Command = $false,
    TriggerType = 'event',
    MessageType = 'Message',
    MessageSubType = 'ChannelJoined'
)]
[cmdletbinding()]
param(        
    [parameter(ValueFromRemainingArguments)]
    $Dummy
)

$greeting = Get-VectoriaResponse -type Greeting
$userId = $Global:PoshBotContext.From
$userMention = "<@$userId>"
$channelId = $Global:PoshBotContext.To
$channelMention = "<#$channelId>"
$text = "$greeting, $userMention. Welcome to $channelMention!"
Write-Output $text
}
$CommandsToExport += 'Welcome-User'`

The get-vectoria command is just a helper function to wrote to vary the responses via Get-Random and an array of words.

The bot responds in slack just fine, but the message is sent twice. Not sure what's going on here...

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.