Skip to content

Instantly share code, notes, and snippets.

@task4233
Last active February 17, 2021 16:01
Show Gist options
  • Save task4233/639cea7946b96e77da2315953d3c2257 to your computer and use it in GitHub Desktop.
Save task4233/639cea7946b96e77da2315953d3c2257 to your computer and use it in GitHub Desktop.
Automuteusのインストール用スクリプト

Scripts for self hosting automuteus

Description

  • procedual for self hosting automuteus on Windows10

Files

  • Install.ps1
    • Install resource for self hosting
  • Run.ps1
    • Run automuteus with AmongUsCapture
  • End.ps1
    • End automuteus

automuteusのセルフホスト用スクリプト

概要

Windows10上でautomuteusをセルフホストするためのリソースインストールおよび実行用スクリプトです。

基本的な使い方

  1. このページの「3. Discord の bot を作成する」を参考にDiscordBotを用意する
  2. ここからzipファイルをダウンロードして解凍
  3. フォルダ内のInstall.ps1を右クリックして, 「PowerShellで実行」を選択して実行
  4. 途中で警告やメッセージが出てきたら「OK」っぽい方を押すようにして, DockerDesktopのインストールが終わるまで待機
  5. DockerDesktopのインストールが終わったら, Steam版のAmongUSを起動
  6. フォルダ内のRun.ps1を右クリックして, 「PowerShellで実行」を選択して実行
  7. Botを追加したDiscordのチャンネルで, .au newをメッセージとして送信
  8. DMで来たメッセージのリンクをクリックして同期

ファイル

  • Install.ps1
    • セルフホストに必要なリソースをダウンロードします
  • Run.ps1
    • AmongUsCaptureおよびAutomuteusを実行します
  • End.ps1
    • automuteusを終了します
docker-compose down
if (!$?) {
return 'failed docker-compose down'
}
### Version Setting ###
$AmongUsCaptureVersion = '2.8.8'
$GalactusVersion = '2.4.1'
$AutomuteusVersion = '6.9.2'
# SET YOUR DISCORD BOT TOKEN
$DiscordBotToken = ''
# Set here if you want to
$GalactusHost = 'http://localhost'
$GalactusExternalPort = '80'
# DownloadFile downloads the resource on $targetURL into $outFilePath
function DownloadFile($targetURL, $outFilePath) {
$uri = New-Object System.Uri($targetURL)
Invoke-WebRequest -Uri $uri -OutFile $outFilePath -UseBasicParsing
if (!$?) {
return 'failed Invoke-WebRequest: ' + $targetURL + ', ' + $outFilePath
}
return ''
}
# DownloadAndUnzipFile download the resource on $targetURL into $outFilePath & unzip the file
function DownloadAndUnzipFile($targetURL, $outFilePath) {
# download file
$outFilePathZip = $outFilePath + ".zip"
$errMes = DownloadFile $targetURL $outFilePathZip
if (![string]::IsNullOrEmpty($errMes)) {
return 'failed DownloadFile: ' + $errMes
}
Expand-Archive -Path $outFilePathZip -DestinationPath '.'
if (!$?) {
Remove-Item $outFilePathZip
return 'failed Expand-Archive: ' + $errMes
}
Remove-Item $outFilePathZip
return ''
}
# install docker
function InstallDocker() {
# check whether docker exists or not
$dockerInstalledPath = 'C:\Program Files\Docker\Docker\Docker Desktop.exe'
$res = Test-Path $dockerInstalledPath
if ($res) {
Get-Command docker -ea SilentlyContinue | Out-Null
if ($? -ne $true) {
Start-Process -FilePath $dockerInstalledPath
}
return 'Successfully installed Docker!'
}
$dockerOutFilePath = 'DockerInstaller.exe'
$res = Test-Path $dockerOutFilePath
if (!$res) {
$dockerTargetURL = 'https://desktop.docker.com/win/stable/Docker Desktop Installer.exe'
$errMes = DownloadFile $dockerTargetURL $dockerOutFilePath
if (![string]::IsNullOrEmpty($errMes)) {
return 'failed to download file for Docker: ' + $errMes
}
}
# run Docker
.\DockerInstaller.exe
if (!$?) {
return 'failed to install Docker'
}
Remove-Item .\DockerInstaller.exe
return ''
}
# install AmongUsCapture
function InstallAmongUsCapture() {
$captureOutFilePath = $AmongUsCaptureVersion
$captureTargetURL = 'https://github.com/denverquane/amonguscapture/releases/download/' + $AmongUsCaptureVersion + '/AmongUsCapture.zip'
# check whether amonguscapture exists or not
$res = Test-Path "AmongUsCapture.exe"
if ($res) {
return 'Successfully installed AmongUsCapture!'
}
$errMes = DownloadAndUnzipFile $captureTargetURL $captureOutFilePath
if (![string]::IsNullOrEmpty($errMes)) {
return 'failed to download file for AmongUsCapture: ' + $errMes
}
# check whether amonguscapture exists or not
$res = Test-Path "AmongUsCapture.exe"
if ($res) {
return 'Successfully installed AmongUsCapture!'
}
}
# install galactus
function InstallGalactUs() {
$galactusTargetURL = 'https://github.com/automuteus/galactus/archive/' + $GalactusVersion + '.zip'
$galactusOutFilePath = 'galactus'
# check whether galactus exists or not
$res = Test-Path ($galactusOutFilePath + "-" + $GalactusVersion)
if ($res) {
return 'Successfully installed Galactus!'
}
$errMes = DownloadAndUnzipFile $galactusTargetURL $galactusOutFilePath
if (![string]::IsNullOrEmpty($errMes)) {
return 'failed to download file for galactus: ' + $errMes
}
# check whether galactus exists or not
$res = Test-Path ($galactusOutFilePath + "-" + $GalactusVersion)
if ($res) {
return 'Successfully installed Galactus!'
}
}
# install automuteus
function InstallAutomuteus() {
$automuteusTargetURL = 'https://github.com/denverquane/automuteus/archive/' + $AutomuteusVersion + '.zip'
$automuteusOutFilePath = 'automuteus'
# check whether automuteus exists or not
$res = Test-Path ($automuteusOutFilePath + "-" + ${AutomuteusVersion})
if ($res) {
return 'Successfully installed automuteus!'
}
$errMes = DownloadAndUnzipFile $automuteusTargetURL $automuteusOutFilePath
if (![string]::IsNullOrEmpty($errMes)) {
return 'failed to download file for automuteus: ' + $errMes
}
# check whether amongmuteus exists or not
$res = Test-Path ($automuteusOutFilePath + "-" + ${AutomuteusVersion})
if ($res) {
return 'Successfully installed automuteus!'
}
}
# helper for adding params
function addEnvParam($targetFilePath, $regexp, $param) {
((Get-Content -path $targetFilePath -Raw) -replace $regexp,($regexp + $param)) | Set-Content -Path $targetFilePath
}
# init automuteus
function InitAutomuteus() {
$basePath = "automuteus-" + $AutomuteusVersion
$envFilePath = $basePath + "/.env"
Copy-Item ($basePath + "/sample.env") $envFilePath
addEnvParam $envFilePath "AUTOMUTEUS_TAG=" $AutomuteusVersion
addEnvParam $envFilePath "GALACTUS_TAG=" $GalactusVersion
addEnvParam $envFilePath "DISCORD_BOT_TOKEN=" $DiscordBotToken
addEnvParam $envFilePath "GALACTUS_HOST=" $GalactusHost
addEnvParam $envFilePath "GALACTUS_EXTERNAL_PORT=" $GalactusExternalPort
}
InstallDocker
InstallDockerCompose
InstallAmongUsCapture
InstallGalactus
InstallAutomuteus
InitAutomuteus
# launch AmongUsCapture
.\AmongUsCapture.exe
if (!$?) {
return 'failed to run AmongUsCapture.exe'
}
# launch automuteus
cd automuteus*
docker-compose pull
if (!$?) {
cd ..
pause
return 'failed docker-compose pull'
}
docker-compose up -d
if (!$?) {
cd ..
pause
return 'failed docker-compose up -d'
}
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment