diff --git a/intervalbot.py b/intervalbot.py index 6fcd0d6..0d99417 100644 --- a/intervalbot.py +++ b/intervalbot.py @@ -35,9 +35,9 @@ INTERVAL = 60 # channel to send the message to -# the message is sent to a channel specified with an ID below +# the message is sent to a channel specified with an ID below as an int # right click on the Discord channel and click 'copy id' to get one -CHANNEL = 'YOUR_DISCORD_CHANNEL_ID_GOES_HERE' +CHANNEL = YOUR_DISCORD_CHANNEL_ID_GOES_HERE # message to be sent # custom message to be sent to specified channel @@ -57,22 +57,21 @@ client = discord.Client() async def send_interval_message(): await client.wait_until_ready() - channel = CHANNEL + channel = client.get_channel(CHANNEL) interval = INTERVAL message = MESSAGE - channel = discord.Object(id=channel) - while not client.is_closed: - await client.send_message(channel, message) + while not client.is_closed(): + await channel.send(message) await asyncio.sleep(interval) # print list of servers where this bot is active to console async def list_servers(): await client.wait_until_ready() - while not client.is_closed: + while not client.is_closed(): # you can customize the output message(s) below print("--- INTERVAL BOT ONLINE ---") - for server in client.servers: + for server in client.guilds: # you can customize the output message(s) below print('Active servers: ' + str(server.name)) await asyncio.sleep(600)