E1102:discord.Client is not callable
Verfasst: Samstag 22. September 2018, 21:17
Hallo,
Ich versuche einfach nur einen Bot für Discord zu programmieren. Jedoch bekomme ich immer wieder Probleme. Zurzeit habe ich beim Code
Die Fehlermeldung
und in der Debug Console
Ich bin total verzweifelt, da mir ständig ein Syntaxfehler vorgeworfen wird, obwohl ich alles richtig geschrieben habe. Ich habe auch schon
und
benutzt (auch wenn beide Befehle aufs selbe hinausführen.
Mit der normalen Python Oberfläche bekomme ich die Fehler
Kann mir jemand weiterhelfen?
Ich versuche einfach nur einen Bot für Discord zu programmieren. Jedoch bekomme ich immer wieder Probleme. Zurzeit habe ich beim Code
Code: Alles auswählen
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client() #Initialise Client
client = commands.Bot(command_prefix = "?") #Initialise client bot
@client.event
async def on_ready():
print("Bot is online and connected to Discord") #This will be called when the bot connects to the server
@client.event
async def on_message(message):
if message.content == "cookie":
await client.send_message(message.channel, ":cookie:") #responds with Cookie emoji when someone says "cookie"
client.run("token") #Replace token with your bots token
Code: Alles auswählen
E1102:discord.Client is not callable
Code: Alles auswählen
Traceback (most recent call last):
File "D:\Kubilay\Python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Kubilay\Python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\__main__.py", line 211, in <module>
singlesession=args.single_session)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\__main__.py", line 205, in main
debug_main(addr, name, kind, *extra, **kwargs)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_local.py", line 30, in debug_main
run_file(address, name, *extra, **kwargs)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_local.py", line 64, in run_file
run(argv, addr, **kwargs)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_local.py", line 125, in _run
_pydevd.main()
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevd.py", line 1743, in main
debugger.connect(host, port)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevd.py", line 1099, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevd.py", line 1106, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "c:\Users\cakma\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "d:\Kubilay\Python\brot.py", line 1, in <module>
import discord
File "D:\Kubilay\Python\lib\site-packages\discord\__init__.py", line 20, in <module>
from . import client
File "D:\Kubilay\Python\lib\site-packages\discord\client.py", line 38, in <module>
from . import state
File "D:\Kubilay\Python\lib\site-packages\discord\state.py", line 36, in <module>
from . import utils, compat
File "D:\Kubilay\Python\lib\site-packages\discord\compat.py", line 32
create_task = asyncio.async
^
SyntaxError: invalid syntax
Code: Alles auswählen
pip install discord.py
Code: Alles auswählen
pip install discord
Mit der normalen Python Oberfläche bekomme ich die Fehler
Code: Alles auswählen
Traceback (most recent call last):
File "D:/Kubilay/Python/pls no.py", line 1, in <module>
import discord
File "D:\Kubilay\Python\lib\site-packages\discord\__init__.py", line 20, in <module>
from . import client
File "D:\Kubilay\Python\lib\site-packages\discord\client.py", line 38, in <module>
from . import state
File "D:\Kubilay\Python\lib\site-packages\discord\state.py", line 36, in <module>
from . import utils, compat
File "D:\Kubilay\Python\lib\site-packages\discord\compat.py", line 32
create_task = asyncio.async
^
SyntaxError: invalid syntax
>>>