
Powershell 기반 봇 프레임워크
PoshBot은 MIT 라이선스의 오픈 소스 프로젝트입니다. 지속적인 개발은 스폰서의 지원 덕분에 가능합니다. 스폰서가 되고 싶으시다면 GitHub Sponsors 또는 Patreon을 통해 가능합니다.
심층 가이드를 원하시나요? Leanpub에서 ChatOps the Easy Way를 확인해보세요!
PoshBot은 PowerShell로 작성된 채팅 봇입니다. PowerShell 5.0에서 도입된 클래스를 광범위하게 사용합니다. PowerShell 모듈이 PoshBot에 로드되면 즉시 봇 명령으로 사용할 수 있습니다. PoshBot은 현재 Slack에 연결하여 멋진 채옵스(ChatOps) 기능을 제공합니다.
원하는 거의 모든 것을 할 수 있습니다 :) 농담 아닙니다. PoshBot은 PowerShell 모듈의 함수나 cmdlet을 실행합니다. PoshBot을 사용하여 서버에 연결하고 상태를 보고하거나, 코드를 배포하고, runbook을 실행하고, API를 쿼리하는 등의 작업을 수행하세요. PowerShell로 작성할 수 있다면 PoshBot이 실행할 수 있습니다.
자세한 문서는 ReadTheDocs에서 확인할 수 있습니다.
PoshBot을 소스에서 빌드하는 방법에 대한 문서는 Building PoshBot을 참조하세요.
각 릴리스의 자세한 변경 사항은 릴리스 노트에 문서화되어 있습니다.
지금 바로 시작하려면 봇용 SLACK-API-TOKEN을 받으세요:
https://my.slack.com/services/new/bot
# Install the module from PSGallery
Install-Module -Name PoshBot -Repository PSGallery
# Import the module
Import-Module -Name PoshBot
# Create a bot configuration
$botParams = @{
Name = 'name'
BotAdmins = @('<SLACK-CHAT-HANDLE>')
CommandPrefix = '!'
LogLevel = 'Info'
BackendConfiguration = @{
Name = 'SlackBackend'
Token = '<SLACK-API-TOKEN>'
}
AlternateCommandPrefixes = 'bender', 'hal'
}
$myBotConfig = New-PoshBotConfiguration @botParams
# Start a new instance of PoshBot interactively or in a job.
Start-PoshBot -Configuration $myBotConfig #-AsJob
기본 사용법:
# Create a Slack backend
$backendConfig = @{Name = 'SlackBackend'; Token = '<SLACK-API-TOKEN>'}
$backend = New-PoshBotSlackBackend -Configuration $backendConfig
# Create a PoshBot configuration
$pbc = New-PoshBotConfiguration -BotAdmins @('<MY-SLACK-HANDLE>') -BackendConfiguration $backendConfig
# Save configuration
Save-PoshBotConfiguration -InputObject $pbc -Path .\PoshBotConfig.psd1
# Load configuration
$pbc = Get-PoshBotConfiguration -Path .\PoshBotConfig.psd1
# Create an instance of the bot
$bot = New-PoshBotInstance -Configuration $pbc -Backend $backend
# Start the bot
$bot.Start()
# Available commands
Get-Command -Module PoshBot
CommandType Name Version Source
----------- ---- ------- ------
Function Get-PoshBot 0.12.0 poshbot
Function Get-PoshBotConfiguration 0.12.0 poshbot
Function Get-PoshBotStatefulData 0.12.0 poshbot
Function New-PoshBotCardResponse 0.12.0 poshbot
Function New-PoshBotConfiguration 0.12.0 poshbot
Function New-PoshBotDiscordBackend 0.12.0 poshbot
Function New-PoshBotFileUpload 0.12.0 poshbot
Function New-PoshBotInstance 0.12.0 poshbot
Function New-PoshBotMiddlewareHook 0.12.0 poshbot
Function New-PoshBotScheduledTask 0.12.0 poshbot
Function New-PoshBotSlackBackend 0.12.0 poshbot
Function New-PoshBotTeamsBackend 0.12.0 poshbot
Function New-PoshBotTextResponse 0.12.0 poshbot
Function Remove-PoshBotStatefulData 0.12.0 poshbot
Function Save-PoshBotConfiguration 0.12.0 poshbot
Function Set-PoshBotStatefulData 0.12.0 poshbot
Function Start-PoshBot 0.12.0 poshbot
Function Stop-Poshbot 0.12.0 poshbot