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"6. Click OAuth2 > URL Generator, check bot under Scopes, then check Send Messages and Read Message History under Bot Permissions"
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 - only needed for !my-steam-profile and automatic Steam ownership counts on !info:"
Write-Host"1. Go to https://steamcommunity.com/dev/apikey and sign in"
Write-Host"2. Enter any domain name (e.g. localhost), agree to the terms, and submit"
Write-Host"3. Copy the API key it shows you"
Write-Host""
$steamKeyInput=Read-Host"Paste your Steam Web API key, or press Enter to skip"
Set-EnvValue"STEAM_API_KEY"$steamKeyInput
}
if(-not(Test-CommandExistsollama)){
Write-Host""
$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..."