poshbotio / PoshBot

Powershell-based bot framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

falkheiland opened this issue · comments

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

  • Module version used: 0.12.0
  • Operating System and PowerShell version: Win 10 Pro, PS 5.1
commented

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

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

commented

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.