Socket
Socket
Sign inDemoInstall

discord-timers

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    discord-timers

Timers for bots made with discord.py


Maintainers
1

Readme

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")

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc