discord

Why doesn't multiple on_message events work?

我的梦境 提交于 2019-11-26 23:19:19
Why can't I have multiple on_message events? import discord client = discord.Client() @client.event async def on_ready(): print('in on_ready') @client.event async def on_message(message): print("in on_message #1") @client.event async def on_message(message): print("in on_message #2") @client.event async def on_message(message): print("in on_message #3") client.run("TOKEN") For example, if I typed anything in discord, it's always only the last on_message that gets triggered. How can I get all three to work? It's not possible with the native Client You can only have one on_message , if you have

create_task = asyncio.async: SyntaxError: invalid syntax

依然范特西╮ 提交于 2019-11-26 20:47:16
I'm creating a bot for Discord, and I just wrote this simple code: import discord TOKEN = "token" client = discord.Client() @client.event async def on_ready(): print('Bot is ready.') client.run(TOKEN) and it produces the following error: Traceback (most recent call last): File "/Users/pcaires/Desktop/Programação/Python/Discord Bots/Main.py", line 1, in <module> import discord File "/Users/pcaires/Desktop/Programação/Python/Discord Bots/venv/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module> from .client import Client, AppInfo, ChannelPermissions File "/Users/pcaires

AttributeError: &#39;Client&#39; object has no attribute &#39;send_message&#39; (Discord Bot)

点点圈 提交于 2019-11-26 14:46:43
For some reason send_message isn't working properly on my Discord bot and I can't find anyway to fix it. import asyncio import discord client = discord.Client() @client.async_event async def on_message(message): author = message.author if message.content.startswith('!test'): print('on_message !test') await test(author, message) async def test(author, message): print('in test function') await client.send_message(message.channel, 'Hi %s, i heard you.' % author) client.run("key") on_message !test in test function Ignoring exception in on_message Traceback (most recent call last): File "C:\Users

create_task = asyncio.async: SyntaxError: invalid syntax

懵懂的女人 提交于 2019-11-26 07:43:12
问题 I\'m creating a bot for Discord, and I just wrote this simple code: import discord TOKEN = \"token\" client = discord.Client() @client.event async def on_ready(): print(\'Bot is ready.\') client.run(TOKEN) and it produces the following error: Traceback (most recent call last): File \"/Users/pcaires/Desktop/Programação/Python/Discord Bots/Main.py\", line 1, in <module> import discord File \"/Users/pcaires/Desktop/Programação/Python/Discord Bots/venv/lib/python3.7/site-packages/discord/__init

AttributeError: &#39;Client&#39; object has no attribute &#39;send_message&#39; (Discord Bot)

不问归期 提交于 2019-11-26 04:56:43
问题 For some reason send_message isn\'t working properly on my Discord bot and I can\'t find anyway to fix it. import asyncio import discord client = discord.Client() @client.async_event async def on_message(message): author = message.author if message.content.startswith(\'!test\'): print(\'on_message !test\') await test(author, message) async def test(author, message): print(\'in test function\') await client.send_message(message.channel, \'Hi %s, i heard you.\' % author) client.run(\"key\") on

Why does on_message stop commands from working?

混江龙づ霸主 提交于 2019-11-25 23:45:41
问题 Basically, everything appears to work fine and start up, but for some reason I can\'t call any of the commands. I\'ve been looking around for easily an hour now and looking at examples/watching videos and I can\'t for the life of me figure out what is wrong. Code below: import discord import asyncio from discord.ext import commands bot = commands.Bot(command_prefix = \'-\') @bot.event async def on_ready(): print(\'Logged in as\') print(bot.user.name) print(bot.user.id) print(\'------\') @bot