krisppurg / dimscord

A Discord Bot & REST Library for Nim.
https://krisppurg.github.io/dimscord/
MIT License
222 stars 20 forks source link

bulkDeleteMessages doesnt work #76

Closed Vaipex closed 2 years ago

Vaipex commented 2 years ago

I tried dimscord today and wanted to use the bulkDeleteMessages proc. I always get this error when I try to compile it. nimble/pkgs/dimscord-1.3.0/dimscord/restapi/guild.nim(90, 25) Error: expression 'none seq[Channel]' has no type (or is ambiguous)

This is my code:

let test = await discord.api.bulkDeleteMessages(chid, msgseq)
echo resptest
krisppurg commented 2 years ago

The line that it points to is at createGuild proc, does it error if you remove the code?

Try doing nimble install dimscord@#head for the fix, since I believe this error occurs when --threads:on

Vaipex commented 2 years ago

Installing @#head didnt help. I got a new error now

dimscord-#head/dimscord/helpers.nim(31, 31) template/generic instantiation of `async` from here
var internalTmpFuture`gensym22: FutureBase = bulkDeleteMessages(discord.api,
    "123", @["123"], "")
yield internalTmpFuture`gensym22
read(cast[typeof(bulkDeleteMessages(discord.api, "123", @["123"], ""))](internalTmpFuture`gensym22))' has no type (or is ambiguous)
krisppurg commented 2 years ago

Did you import asyncdispatch?

Vaipex commented 2 years ago

yes

krisppurg commented 2 years ago

For messageCreate proc, could you remove the {.event(discord).} pragma and leave as something like this?

proc messageCreate(s: Shard, m: Message) {.async.} =
  ...

discord.events.messageCreate = messageCreate

This will make the error a bit more easier to understand.

Vaipex commented 2 years ago

Looks like its the same error

template/generic instantiation of `async` from here
Error: expression '
var internalTmpFuture`gensym21: FutureBase = bulkDeleteMessages(discord.api,
    "123", @["123"], "")
yield internalTmpFuture`gensym21
read(cast[typeof(bulkDeleteMessages(discord.api, "123", @["123"], ""))](internalTmpFuture`gensym21))' has no type (or is ambiguous)
krisppurg commented 2 years ago

Hmm, the code looks fine to me. Try sending your code that isn't exactly simplified.

Vaipex commented 2 years ago

I found the issue, bulkDeleteMessages doesnt return anything. await discord.api.bulkDeleteMessages("123", @["123"]) works just fine. Thank you for your time!