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

JSON ambiguous call #31

Open
Nedss opened this issue Jul 26, 2019 · 0 comments
Open

JSON ambiguous call #31

Nedss opened this issue Jul 26, 2019 · 0 comments

Comments

@Nedss
Copy link

Nedss commented Jul 26, 2019

Hello !

I tried to run basic_bot.nim code. Unfortunately it is not compile and return an error message after compiling with nim c -d:ssl mycode.nim :

/Users/nedss/.nimble/pkgs/discord-2.3.0/src/discord.nim(107, 115) template/generic instantiation of `async` from here /Users/nedss/.nimble/pkgs/discord-2.3.0/src/discord.nim(121, 35) template/generic instantiation of `%*` from here /Users/nedss/.nimble/pkgs/discord-2.3.0/src/discord.nim(123, 14) template/generic instantiation of `%` from here /Users/nedss/.choosenim/toolchains/nim-0.20.2/lib/pure/json.nim(369, 41) Error: ambiguous call; both json.%(opt: Option[%.T]) [declared in /Users/nedss/.choosenim/toolchains/nim-0.20.2/lib/pure/json.nim(343, 6)] and objects.%(o: Option[%.T]) [declared in /Users/nedss/.nimble/pkgs/discord-2.3.0/src/objects.nim(630, 6)] match for: (Option[system.string])

I put there my code :

import asyncdispatch, discordnim

proc messageCreate(s: Shard, m: MessageCreate) =
  if s.cache.me.id == m.author.id: return
  if m.content == "ping":
    asyncCheck s.channelMessageSend(m.channel_id, "pong")                           

let d = newShard("Bot <token>")
proc endSession() {.noconv.} =
  waitFor d.disconnect()
setControlCHook(endSession)
let removeProc = d.addHandler(EventType.message_create, messageCreate)
waitFor d.startSession()
removeProc()

I work on MACOS (Mojave) 10.14.6 and have the last version of NIM.

Nim Compiler Version 0.20.2 [MacOSX: amd64]
Compiled at 2019-07-17
Copyright (c) 2006-2019 by Andreas Rumpf

Do you have an idea about this problem ?

Thanks, and thanks for your job !

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