poshbotio / PoshBot

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

Poshbot.Shell #167

Closed tuplink closed 5 years ago

tuplink commented 5 years ago

Are there any plans to make a slimmed down poshbot that will allow the same Plugin Modules to be imported and run from the shell

Expected Behavior

Import-Module xxxxxx Plugin-Function -ip xxx.xxx.xxx.xxx

Current Behavior

Cannot find the type for custom attribute 'PoshBot.BotCommand'. Make sure that the assembly that contains this type is loaded.

Possible Solution

Slimmed down version of poshbot -permissions -ChatBackends, New-PoshbotCardresponse and such be replaces with shell output

Your Environment

devblackops commented 5 years ago

Hi @tuplink. This is already possible.

In your own plugin, when you're using PoshBot-specific functionality like [PoshBot.BotCommand()] or New-PoshBotCardResponse, etc., you should take a dependency on PoshBot in your module manifest file by using RequiredModules = @('PoshBot'). If you do this, then you won't get an error when you use PoshBot.BotCommand()] as the PoshBot module will be loaded when you load your own module.

Just define RequiredModules = @('PoshBot') in your manifest and you can use execute your functions directly in the shell like any other module.