Skip to main content

Timers for bots made with discord.py

Project description

discord-timers

A simple extension for discord.py which provides basic timer support.

Installing

pip install discord-timers -U

Example

import datetime

from discord.ext import commands, timers


bot = commands.Bot(command_prefix="!")
bot.timer_manager = timers.TimerManager(bot)


@bot.command(name="remind")
async def remind(ctx, time, *, text):
    """Remind to do something on a date.

    The date must be in ``Y/M/D`` format."""
    date = datetime.datetime(*map(int, time.split("/")))

    bot.timer_manager.create_timer("reminder", date, args=(ctx.channel.id, ctx.author.id, text))
    # or without the manager
    timers.Timer(bot, "reminder", date, args=(ctx.channel.id, ctx.author.id, text)).start()

@bot.event
async def on_reminder(channel_id, author_id, text):
    channel = bot.get_channel(channel_id)

    await channel.send("Hey, <@{0}>, remember to: {1}".format(author_id, text))


bot.run("token")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord-timers-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distributions

discord_timers-0.1.0-py3.7.egg (8.9 kB view details)

Uploaded Source

discord_timers-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file discord-timers-0.1.0.tar.gz.

File metadata

  • Download URL: discord-timers-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for discord-timers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 034dd9ad7657a992dbaa98d6b29c5e389df5b727d24f46be817c95adf719f3f4
MD5 d3d7343024673c494c143d4903176f38
BLAKE2b-256 9828ab479f72fd14ac4affacee448acd09ea9f618bc6b05ada38d3e1412cd780

See more details on using hashes here.

File details

Details for the file discord_timers-0.1.0-py3.7.egg.

File metadata

  • Download URL: discord_timers-0.1.0-py3.7.egg
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for discord_timers-0.1.0-py3.7.egg
Algorithm Hash digest
SHA256 64ba41ee93ba80406b08b25ea6235e73fbc6958585a8d9bd85368d1f9e17fa86
MD5 753e614deefd3045493c8ea74629abef
BLAKE2b-256 f1083f50316b3a2f0b8daf991caed186fb801f56ed38e2978aa47e160dbbbdb5

See more details on using hashes here.

File details

Details for the file discord_timers-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: discord_timers-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for discord_timers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a58b511562d26d931d86c70cddde15efbd45edbefe5fa56b3672a098e3e24a8
MD5 0ad78be3bc238b32975e15f57d1e213f
BLAKE2b-256 b9105b7e98393038b3804329258fe2885778f68b2e3f86b347e757c36e64fe23

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page