All Projects → robertwayne → cogwatch

robertwayne / cogwatch

Licence: MIT License
Automatic hot-reloading for your discord.py command files.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to cogwatch

discord-ui
A discord.py extension for sending, receiving and handling ui interactions in discord
Stars: ✭ 28 (+64.71%)
Mutual labels:  discord, discord-bot, discord-py
DueUtil
DueUtil the questing and fun Discord bot
Stars: ✭ 16 (-5.88%)
Mutual labels:  discord-bot, discord-py
Discord-Bot-Choo-Choo
Coding Train Example Discord Bot
Stars: ✭ 35 (+105.88%)
Mutual labels:  discord, discord-bot
TragicSimpBot
TragicSimp is a discord bot that can send memes, facts, jokes, quotes, and track user stats. This bot has leveling system which rank user based on their commands in a channel created by Bot
Stars: ✭ 22 (+29.41%)
Mutual labels:  discord-bot, discord-py
Aqua-Bot
디스코드 NSFW 챗봇 아쿠아 봇입니다.
Stars: ✭ 13 (-23.53%)
Mutual labels:  discord, discord-bot
albion-discord-bot
Discord Bot for Albion Online that: fetch market prices, search players/guilds, and more!
Stars: ✭ 27 (+58.82%)
Mutual labels:  discord-bot, discord-py
Harmonbot
Multi-Platform Factotum Bot
Stars: ✭ 30 (+76.47%)
Mutual labels:  discord-bot, discord-py
Green-bot
🎧 Green-bot is a powerfull discord music bot used by 10M users and more than 50,000 servers
Stars: ✭ 103 (+505.88%)
Mutual labels:  discord, discord-bot
easypoll-v3
EasyPoll Discord Bot | With EasyPoll, a Discord Poll Bot, you can easily create polls and your members can vote by clicking on a reaction very easily and quickly.
Stars: ✭ 35 (+105.88%)
Mutual labels:  discord, discord-bot
eco-bot
A Economy Bot made using discord module of python
Stars: ✭ 31 (+82.35%)
Mutual labels:  discord-bot, discord-py
miso-bot
Discord bot with too many features
Stars: ✭ 41 (+141.18%)
Mutual labels:  discord-bot, discord-py
warnable
Simple Discord bot to moderate Discord servers, specifically to warn members.
Stars: ✭ 34 (+100%)
Mutual labels:  discord, discord-bot
discord-uptime
Discord bot to monitor uptime of services using ping and http requests
Stars: ✭ 46 (+170.59%)
Mutual labels:  discord-bot, discord-py
cytrus-re
A multipurpose Discord bot!
Stars: ✭ 16 (-5.88%)
Mutual labels:  discord, discord-bot
Licensy
Discord bot that manages expiration of roles with subscriptions!
Stars: ✭ 47 (+176.47%)
Mutual labels:  discord-bot, discord-py
Discord-Tools
VSCode extension allowing the integration of a Discord chat, bot templates, snippets, themes and more!
Stars: ✭ 91 (+435.29%)
Mutual labels:  discord-bot, discord-py
Axley
A simple multi-purpose Discord bot being made using Discord.py API wrapper..
Stars: ✭ 16 (-5.88%)
Mutual labels:  discord-bot, discord-py
1bot
"One bot, several uses". 1Bot is a multipurpose bot that has all the moderation tools you need, lots of useful utility commands, and a bunch of fun commands that we all need once in a while.
Stars: ✭ 19 (+11.76%)
Mutual labels:  discord-bot, discord-py
Discord-Moderation-Bot
Modular Moderation bot for Discord
Stars: ✭ 49 (+188.24%)
Mutual labels:  discord-bot, discord-py
Online-Forever
A Code that can make your Discord Account 24/7!
Stars: ✭ 246 (+1347.06%)
Mutual labels:  discord-bot, discord-py

Cog Watch

With the recent news that `discord.py` will no longer be mainainted, as well as my own bot being moved over to Rust w/ Twilight for several months now, this project will no longer be maintained.


Automatic hot-reloading for your discord.py command files.

Version Python Version

cogwatch is a utility that you can plug into your discord.py bot that will watch your command files directory (cogs) and automatically reload them as you modify or move them around in real-time. No more reloading your bot / command yourself every time you edit an embed just to make sure it looks perfect!

Features

  • Automatically reloads commands in real-time as you edit them (no !reload needed).
  • Can handle the loading of all your commands on start-up (no boilerplate).

Getting Started

You can install the library with pip install cogwatch.

Import the watch decorator and apply it to your on_ready method and let the magic take effect.

See the examples directory for more details, as well as an example on how to use the cog concept in dpymenus if you are unfamiliar with it.

import asyncio
from discord.ext import commands
from cogwatch import watch


class ExampleBot(commands.Bot):
    def __init__(self):
        super().__init__(command_prefix='!')

    @watch(path='commands')
    async def on_ready(self):
        print('Bot ready.')

    async def on_message(self, message):
        if message.author.bot:
            return

        await self.process_commands(message)


async def main():
    client = ExampleBot()
    await client.start('YOUR_TOKEN_GOES_HERE')

if __name__ == '__main__':
    asyncio.run(main())

Configuration

You can pass any of these values to the decorator:

path='commands': Root name of the cogs directory; cogwatch will only watch within this directory -- recursively.

debug=True: Whether to run the bot only when the Python __debug__ flag is True. Defaults to True.

loop=None: Custom event loop. Defaults to the current running event loop.

default_logger=True: Whether to use the default logger (to sys.stdout) or not. Defaults to True.

preload=False: Whether to detect and load all found cogs on start. Defaults to False.

NOTE: cogwatch will only run if the __debug__ flag is set on Python. You can read more about that here. In short, unless you run Python with the -O flag from your command line, __debug__ will be True. If you just want to bypass this feature, pass in debug=False and it won't matter if the flag is enabled or not.

Logging

By default, the utility has a logger configured so users can get output to the console. You can disable this by passing in default_logger=False. If you want to hook into the logger -- for example, to pipe your output to another terminal or tail a file -- you can set up a custom logger like so:

import logging
import sys

watch_log = logging.getLogger('cogwatch')
watch_log.setLevel(logging.INFO)
watch_handler = logging.StreamHandler(sys.stdout)
watch_handler.setFormatter(logging.Formatter('[%(name)s] %(message)s'))
watch_log.addHandler(watch_handler)

Check out my other discord.py utility: dpymenus -- Simplified menus for discord.py developers.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].