Write-Host"1. Go to https://discord.com/developers/applications and sign in"
Write-Host"2. Click New Application, name it anything, create it"
Write-Host"3. Click Bot in the left sidebar"
Write-Host"4. IMPORTANT - scroll to Privileged Gateway Intents, turn ON both Message Content Intent and Server Members Intent, then click the Save Changes button at the bottom."
Write-Host" The toggles by themselves do not save. If you skip Save Changes, the bot will fail to log in with a disallowed intents error."
Write-Host"5. Click Reset Token (or Copy) and copy the token"
Write-Host"7. IMPORTANT - a URL appears at the bottom of that page. Copy it, paste it into your web browser, press Enter, pick your server, and click Authorize."
Write-Host" Creating the bot does NOT add it to your server. It will not show up in your server until you open that URL and authorize it there."
Write-Host""
$tokenInput=Read-Host"Paste your Discord bot token"
Write-Host"Optional - lets the AI chat look things up on the web (like exact item locations or boss strategies) instead of only relying on what the AI model already knows. Free, no credit card required:"
Write-Host"1. Go to https://app.tavily.com/ and sign up"
Write-Host"2. Copy the API key it shows you (starts with tvly-)"
Write-Host"Optional - lets people with a specific Discord role run !docker ps and !docker restart CONTAINER to manage Docker containers on a remote server over SSH (e.g. an Unraid box running your game servers). Requires SSH key access to that server already set up:"
Write-Host""
$dockerHostInput=Read-Host"SSH host for the Docker server (e.g. chappie.local), or press Enter to skip"
$aiAnswer=Read-Host"Want the bot to use AI to give smarter, in-character answers when people chat with it? This is free - it installs Ollama and runs a small AI model locally on this machine, no API key or cost involved. [y/N]"
if($aiAnswer-eq"y"-or$aiAnswer-eq"Y"){
if(Test-CommandExistswinget){
Write-Host"Installing Ollama..."
wingetinstall--idOllama.Ollama-e
}else{
Write-Host"Install it yourself from https://ollama.com/download, then run this script again to finish setting it up."
}
}else{
Write-Host"Skipping - the bot won't reply to chat mentions. Run this script again any time to set it up."
}
}
if(Test-CommandExistsollama){
$currentModel=Get-EnvValue"OLLAMA_MODEL"
if([string]::IsNullOrWhiteSpace($currentModel)){
$currentModel="llama3.2"
Set-EnvValue"OLLAMA_MODEL"$currentModel
}
$modelList=&ollamalist2>$null
$modelFound=$false
foreach($linein$modelList){
if($line-match[regex]::Escape($currentModel)){
$modelFound=$true
break
}
}
if(-not$modelFound){
Write-Host""
Write-Host"Downloading the $currentModel model for the bot to use (one-time, may take a few minutes)..."
ollamapull$currentModel
if($LASTEXITCODE-ne0){
Write-Host"Could not download the model automatically - make sure Ollama is running, then run: ollama pull $currentModel"
}
}
}
if(-not(Test-CommandExistspm2)){
Write-Host""
Write-Host"Installing pm2 to keep the bot running in the background..."