Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting new discord bot instance gives method not found: no ForEach in PSCustomObject #225

Open
uxlapogi opened this issue Mar 5, 2021 · 2 comments

Comments

@uxlapogi
Copy link

uxlapogi commented Mar 5, 2021

Expected Behavior

Bot instances starts without an error. :(

Current Behavior

PoshBot.psm1:6886:
[System.Management.Automation.PSCustomObject] no method found "ForEach"

Possible Solution

This is my first time starting a poshbot instance. The bot is offline in the channel.

Steps to Reproduce (for bugs)

Used command flow:

Import-Module PoshBot

$botConfig = Get-PoshBotConfiguration -Path .\ValBotConfig.psd1
$backend = New-PoshBotDiscordBackend -Configuration $botConfig.BackendConfiguration

$bot = New-PoshBotInstance -Configuration $botConfig -Backend $backend
$bot | Start-PoshBot -Verbose

ValBotConfig.psd1

@{
ApprovalConfiguration = @{
Commands = @()
ExpireMinutes = 30
}
DisallowDMs = $False
ModuleManifestsToLoad = @()
LogDirectory = 'C:\ValBot'
Name = 'ValBot'
BotAdmins = @('xxx')
AlternateCommandPrefixSeperators = @(':',',',';')
CommandHistoryMaxLogSizeMB = 10
MiddlewareConfiguration = @{
PreReceive = @()
PostReceive = @()
PreExecute = @()
PostResponse = @()
PreResponse = @()
PostExecute = @()
}
FormatEnumerationLimitOverride = -1
LogLevel = 'Verbose'
SendCommandResponseToPrivate = @()
ChannelRules = @{
IncludeCommands = @('*')
Channel = 'valbot'
ExcludeCommands = @()
}
ConfigurationDirectory = 'C:\ValBot'
MaxLogsToKeep = 5
AddCommandReactions = $True
CommandHistoryMaxLogsToKeep = 5
MaxLogSizeMB = 10
PluginDirectory = 'C:\ValBot'
MuteUnknownCommand = $False
PluginConfiguration = @{

}
AlternateCommandPrefixes = @('valbot')
CommandPrefix = '!'
BackendConfiguration = @{
Name = 'DiscordBackend'
Token = 'xxx'
ClientId = 'xxx'
GuildId = 'xxx'
}
PluginRepository = @('PSGallery')
LogCommandHistory = $True
}

Context

I'm trying to get a Discord Bot to control my Valheim dedicated server.

Your Environment

  • Module version used: PoshBot 0.13.0
  • Operating System and PowerShell version:
    Windows Server 2019 Datacenter
    5.1.17763.1490
@devblackops
Copy link
Member

@uxlapogi It looks like you're getting an error here when loading the Discord users. Can you change the LogLevel to Debug in your config and share that log output?

Please make sure to sanitize any sensitive info before sharing!

@mechaming
Copy link

mechaming commented Mar 9, 2021

I'm also having the same issue. Windows 10, powershell 5.1, powershell 7.0

I was able to get it working by upgrading powershell 7 to 7.1.2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants