poshbotio / PoshBot

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

Discord Formating New-PoshBotCardResponse Parameter fields does not display as table #194

Closed falkheiland closed 4 years ago

falkheiland commented 4 years ago

Trying to pass a (ordered) hashtable as Discord message (card).

Expected Behavior

A hashtable to display as a table in the card response.

Current Behavior

Output in discord is neither ordered nor a table which resembles the results correcty.

Possible Solution

Steps to Reproduce (for bugs)

New-PoshBotCardResponse -Type Normal -Fields $response

$response is a ordered hashtable, already ordered by time.

$response output:

Name                           Value
----                           -----
2019-11-24T04:06:37            BIGBearBuDha420
2019-11-24T04:07:17            g1rthyx
2019-11-24T04:12:00            litefighter6
2019-11-24T04:35:15            crazy_84aac
2019-11-24T04:49:41            MillerTime33B
2019-11-24T04:51:39            litefighter6
2019-11-24T06:15:31            litefighter6
2019-11-24T06:19:10            MillerTime33B
2019-11-24T06:52:42            RippingUaNew2day
2019-11-24T07:23:01            Amythyst45

Output in Discord:

image

Context

I want to create a discord message with a ordered table.

Your Environment

Adamvg commented 4 years ago

The best way I found is to create a string then paste that as the hashtable. Something like this works well... There is probably a better way to do it, but this'll work while you wait for a better response.

$response | foreach{$tempNameString += @"
$_.Name

"@
$tempTimeString += @"
$_.Value

"@
}

$HashTable = @{
     Name = $tempNameString
     Value = $tempTimeString
}@

New-PoshBotCardResponse -Fields $HashTable
falkheiland commented 4 years ago

The best way I found is to create a string then paste that as the hashtable. Something like this works well... There is probably a better way to do it, but this'll work while you wait for a better response.

thanks, will definitely try that

stale[bot] commented 4 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.