cameroncros / OctoPrint-DiscordRemote

Discord plugin for OctoPrint
MIT License
66 stars 34 forks source link

Documented permissions are not sufficient #184

Closed rikrose closed 2 years ago

rikrose commented 3 years ago

Describe the bug At https://github.com/cameroncros/OctoPrint-DiscordRemote#create-the-discord-bot--in-discord the recommendation is to follow the instructions at https://github.com/Chikachi/DiscordIntegration/wiki/How-to-get-a-token-and-channel-ID-for-Discord

When you get to https://github.com/Chikachi/DiscordIntegration/wiki/How-to-get-a-token-and-channel-ID-for-Discord#add-your-new-discord-bot-user-to-your-discord-serverguild the link is https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot&permissions=3072 with CLIENT_ID replaced by your bot's Client ID. These permissions are insufficient.

I used permissions=60416 (View Channels, Send Messages, View Channels, Manage Messages, Embed Links, Attach Files) and my bot started working. Advise updating documentation by cloning and updating to be correct, rather than referring to old documentation with changes.

Logs 2021-03-24 13:00:25,706 ERROR URL: https://discord.com/api/channels/[channel_id]/messages 2021-03-24 13:00:25,707 ERROR Headers: {'Authorization': 'Bot [bot_token]', 'User-Agent': 'myBotThing (http://some.url, v0.1)'} 2021-03-24 13:00:25,708 ERROR Data: {'payload_json': '{"embed": {"fields": [{"name": "Local IP", "value": "192.168.1.148", "inline": true}, {"name": "External IP", "value": "50.54.141.84", "inline": true}, {"name": "Operational", "value": "Yes", "inline": true}, {"name": "Extruder Temp (tool0)", "value": "23.71", "inline": true}, {"name": "Bed Temp", "value": "31.67", "inline": true}, {"name": "Printing", "value": "No", "inline": true}], "author": {"name": ""}, "title": "Current Status", "timestamp": "2021-03-24T20:00:25.430242", "color": 15919147}}'} 2021-03-24 13:00:25,710 ERROR Files: None 2021-03-24 13:00:25,711 INFO Message queued 2021-03-24 13:00:31,523 INFO Presence: {"op": 3, "d": {"activities": [], "status": "online", "afk": false, "since": null}} 2021-03-24 13:00:41,552 INFO Presence: {"op": 3, "d": {"activities": [], "status": "online", "afk": false, "since": null}} 2021-03-24 13:00:51,569 INFO Presence: {"op": 3, "d": {"activities": [], "status": "online", "afk": false, "since": null}} 2021-03-24 13:01:01,584 INFO Presence: {"op": 3, "d": {"activities": [], "status": "online", "afk": false, "since": null}} 2021-03-24 13:01:06,377 INFO Heartbeat: {"op": 1, "d": 17} 2021-03-24 13:01:06,472 INFO Received HEARTBEAT_ACK message 2021-03-24 13:01:06,715 ERROR Failed to send message: 2021-03-24 13:01:06,717 ERROR Response: 403 2021-03-24 13:01:06,719 ERROR Response Content: b'{"message": "Missing Permissions", "code": 50013}' 2021-03-24 13:01:06,721 ERROR Response Headers: {'Date': 'Wed, 24 Mar 2021 20:01:06 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=d4da0fbf4c16693d9c20b85313c7db48b1616616066; expires=Fri, 23-Apr-21 20:01:06 GMT; path=/; domain=.discord.com; HttpOnly; SameSite=Lax; Secure', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'x-ratelimit-bucket': '80c17d2f203122d936070c88c8d10f33', 'x-ratelimit-limit': '5', 'x-ratelimit-remaining': '4', 'x-ratelimit-reset': '1616616072', 'x-ratelimit-reset-after': '5', 'x-envoy-upstream-service-time': '23', 'Via': '1.1 google', 'Alt-Svc': 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400', 'CF-Cache-Status': 'DYNAMIC', 'cf-request-id': '09076ca61c0000fdb169240000000001', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Report-To': '{"group":"cf-nel","endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=DQ1D8VtQhuigsGGA8MkQkqIQtzovhoDcoE%2FinswcDaKYk1pljlS8zmN6M5MvKESSawV%2Fhmq0vv%2Fbd96JGMWWzc8VT0raoceIko%2BY%2Fw%3D%3D"}],"max_age":604800}', 'NEL': '{"report_to":"cf-nel","max_age":604800}', 'X-Content-Type-Options': 'nosniff', 'Server': 'cloudflare', 'CF-RAY': '63527d502e8efdb1-PDX', 'Content-Encoding': 'gzip'}

To Reproduce See description

Expected behavior Expected bot to show some kind of error. Perhaps the status of a posted "I've logged on" message should color the icon on the dashboard.

Screenshots Not applicable

Desktop (please complete the following information): Not applicable

Smartphone (please complete the following information): Not applicable

Additional context Not needed

cameroncros commented 3 years ago

Please feel free to contribute this change.