Closed megamorf closed 5 years ago
In trying to fix my issue (#26) I had a similar error arise when trying to run PoshBot using the latest PowerShell available from their GitHub:
WARNING: You are using PSSlack in with .NET Core. Several features will not work:
Set-PSSlackConfig cannot serialize tokens or URIs
[System.Drawing.Color]::SOmeColor shortcut is not available
Cannot find an overload for "GetEnumerator" and the argument count: "0".
At line:1 char:1
+ & 'C:\Users\aemiller\Scripts\Bot\Bot.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Looks like at least in my case, it is because that version of PowerShell is using .NET Core, which is more stripped down than what ships with full Windows. This is likely a similar issue with yours, as Nano Server probably ships with .NET Core.
Yeah, the missing color class error of PSSlack broke my docker build on NanoServer so I had to fix it by changing the ErrorActionPreference prior to importing PoshBot:
# configure shell default parameters
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Install PoshBot and create new PoshBot configuration and store it for later use
RUN Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; \
Install-Module -Name PoshBot -RequiredVersion $env:PoshBotVersion -Repository PSGallery -Force; \
$ErrorActionPreference = 'Ignore'; \
Import-Module -Name PoshBot -ErrorAction SilentlyContinue; \
$ErrorActionPreference = 'Stop'; \
New-PoshBotConfiguration | Save-PoshBotConfiguration
@megamorf I'm hacking away at some of these bugs in Nano. I squash one, another appears ☹️
It may be a bit before this is fully working on Nano. Have you tried it on Windows 2012R2\2016 or Windows 10? Does it work for you?
Aside from the PSSlack issue, I think the Nano Server issues are fixed. I'll try to do some more testing tonight and commit my changes.
@megamorf I have published a Docker image of v0.2.2 here. It's also been published to PSGallery.
Can you try running the following?
docker run -it -e SLACK_TOKEN="<YOUR-SLACK-TOKEN>" -e BOT_ADMINS="<YOUR-HANDLE>" -v C:/temp/poshbot_docker_volume/:c:/poshbot_data poshbotio/poshbot-nano-slack:0.2.2
Note the use of the Docker volume. PoshBot will store all configuration in this directory so subsequent invocations should read in the configuration.
@devblackops hey, thanks for that :+1: . I'll check it out some time this week.
You could suppress the PSSlack warning when importing if desired. I think I'll kill that warning shortly, just need to make sure to document that bit in the readme/about.
Cheers!
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.
Expected Behavior
Bot starts when you run
$bot.start()
on NanoServer.Current Behavior
Bot start is interrupted by GetEnumerator error on NanoServer.
Possible Solution
None.
Steps to Reproduce (for bugs)
Generate new config with New-PoshBotConfiguration and save to file with Save-PoshBotConfiguration:
Context
The issue prevents me from testing PoshBot on NanoServer.
Your Environment