Discord.py: How do I send messages to a specific channel?

Created on 18 Jul 2017  路  9Comments  路  Source: Rapptz/discord.py

I'm trying to make a bot that every thirty seconds it sends a piece of text to #bot-commands. How would I do this?

Code:
import discord
import time
client = discord.Client()
time.sleep(30)
channel.send(ChannelIDHere,'Hello')
client.run('mytokenboi')
Nothing gets sent.

Note: it is a selfbot.

Thanks!

invalid question

Most helpful comment

wait i can i never realised

All 9 comments

Read this: http://discordpy.readthedocs.io/en/latest/faq.html?highlight=sleep#what-does-blocking-mean

Don't use time.sleep, instead use asyncio.sleep.

Now getting syntax errors
import discord
import asyncio
client = discord.Client()
await [redtext]asyncio[/redtext].sleep(30)
channel.send((discord.Object(id='12324234183172'), 'Hello')
client.run('token')

Please use code tags/markup.

What Python version are you running?

read what @PapyrusThePlant said

await [redtext] asyncio [/redtext].sleep(30)

Someone close this, ty!

wait i can i never realised

await client.send_message(discord.Object(id='1234567890'), 'hello')

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoshuck picture marcoshuck  路  16Comments

TomOrth picture TomOrth  路  15Comments

Yuvira picture Yuvira  路  18Comments

wolfclaws picture wolfclaws  路  17Comments

pappabewar picture pappabewar  路  26Comments