SinisterRectus / Discordia

Discord API library written in Lua for the Luvit runtime environment
MIT License
688 stars 144 forks source link

Discord bot won't update game or respond to messages. #380

Closed simplistic111 closed 1 year ago

simplistic111 commented 1 year ago

So I've been trying to code my discord bot, but it never does anything clientside.

This is the code:

`local discordia = require('discordia') local json = require('json') local client = discordia.Client() local prefix = "!"

client:on('ready', function() print("yay!") client:setGame("Hello World!") end)

local file = io.open('./token.txt') local token = file:read('*a') file:close()

client:run('Bot '.. token)`

All gateway intents are turned on.

How do I fix this? Thanks!

Lort533 commented 1 year ago
  1. Your code seems to be missing the gateway intents change, see: https://github.com/SinisterRectus/Discordia/discussions/369

  2. setGame is deprecated, use setActivity instead.

  3. In future, use the Discord server for issues, questions, etc. See: https://discord.gg/sinisterware

simplistic111 commented 1 year ago
  1. Your code seems to be missing the gateway intents change, see: Discordia 2.11.0 and Discord API v8 #369
  2. setGame is deprecated, use setActivity instead.
  3. In future, use the Discord server for issues, questions, etc. See: https://discord.gg/sinisterware

Now I have a different problem, none of the methods of defining the gateway intents actually work. I've tried enums, putting in in the variables, defining each one seperately, and the rest.

This is the method that I currently have in the script: local client = discordia.Client() client:enableAllIntents()

...and this is the output. main.lua:5: attempt to call method 'enableAllIntents' (a nil value)

simplistic111 commented 1 year ago
  1. Your code seems to be missing the gateway intents change, see: Discordia 2.11.0 and Discord API v8 #369
  2. setGame is deprecated, use setActivity instead.
  3. In future, use the Discord server for issues, questions, etc. See: https://discord.gg/sinisterware

Now I have a different problem, none of the methods of defining the gateway intents actually work. I've tried enums, putting in in the variables, defining each one seperately, and the rest.

This is the method that I currently have in the script: local client = discordia.Client() client:enableAllIntents()

...and this is the output. main.lua:5: attempt to call method 'enableAllIntents' (a nil value)

Nevermind, Discordia was on version 2.8.4 for me. Everything ended up working. Thank you!