Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to Discord backend #249

Open
AndrewJNet opened this issue Aug 25, 2023 · 1 comment
Open

Cannot connect to Discord backend #249

AndrewJNet opened this issue Aug 25, 2023 · 1 comment

Comments

@AndrewJNet
Copy link

AndrewJNet commented Aug 25, 2023

Expected Behavior

Expect to connect to Discord without error

Current Behavior

Running Start-PoshBot will lead to the following 403 Forbidden errors and warnings when running the "Log into Discord with the bot token" section:

Write-Error:
Line |
16 | $bot | Start-PoshBot -Verbose
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"DataTime":"2023-08-25 03:36:15Z","Class":"DiscordConnection","Method":"ConnectGateway","Severity":"Error","LogLevel":"Info","Message":"Unable to determine Discord gateway URL","Data":{"CommandName":"Invoke-RestMethod","Message":"Response status code does not indicate success: 403 (Forbidden).","TargetObject":{"Version":{"Major":1,"Minor":1,"Build":-1,"Revision":-1,"MajorRevision":-1,"MinorRevision":-1},"VersionPolicy":0,"Content":null,"Method":{"Method":"GET"},"RequestUri":"https://discordapp.com/api/gateway/bot","Headers":[{"Key":"Authorization","Value":["Bot BOTTOKENREDACTED"]},{"Key":"User-Agent","Value":["Mozilla/5.0","(Windows NT 10.0; Microsoft Windows 10.0.22621; en-US)","PowerShell/7.3.6"]}],"Properties":[],"Options":[]},"Position":"At C:\Program Files\WindowsPowerShell\Modules\PoshBot\0.13.0\PoshBot.psm1:7439 char:33\r\n+ … tewayInfo = Invoke-RestMethod -Uri 'https://discordapp.com/api/gatewa …\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~","CategoryInfo":"InvalidOperation: (Method: GET, Reques…PowerShell/7.3.6\r\n}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException","FullyQualifiedErrorId":"WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"}}

WARNING: {"DataTime":"2023-08-25 03:36:16Z","Class":"DiscordConnection","Method":"ReadReceiveJob","Severity":"Warning","LogLevel":"Info","Message":"Receive job state is [Failed]. Attempting to reconnect...","Data":null}

Possible Solution

Unsure. I am still troubleshooting.

Steps to Reproduce (for bugs)

Run the following:

Import-Module PoshBot
$pbc = New-PoshBotConfiguration
$pbc.BotAdmins = @('username')

$backendConfig = @{
Name = 'JohnsonBot'
Token = 'TOKEN'
ClientId = 'CLIENTID'
GuildId = 'GUILDID'
}

$backend = New-PoshBotDiscordBackend -Configuration $backendConfig

$bot = New-PoshBotInstance -Configuration $pbc -Backend $backend
$bot | Start-PoshBot -Verbose

Context

Moving PoshBot to a new computer and I'm running into this error. I've double-checked the ClientId and GuildId, as well as regenerated the token a number of times to make sure they were correct. Originally I had copied my configuration over from the old computer but after I experienced errors I tried starting from scratch. I'm a bit out of my element with this troubleshooting so I wanted to file an issue while I dug into it in case anyone is seeing a similar issue.

Your Environment

  • Module version used: PoshBot 0.13.0
  • Operating System and PowerShell version: Windows 11 22H2. Tested with PowerShell 7.3.6 and WindowsPowerShell 5.1.22621.1778
@AndrewJNet
Copy link
Author

Just discovered this was solved with #240 ! I was able to apply the changes locally and my bot fired up right away.

@devblackops do you plan on updating the release version on PSGallery?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant