Skip to content

Updated the code to be able to run with the latest version of discord.py #3

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions intervalbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down