auto_help update and clearer messages
This commit is contained in:
parent
a845977cc4
commit
bfc65e262e
@ -3,15 +3,14 @@ import random
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
from redbot.core.utils.chat_formatting import pagify, box
|
from redbot.core.utils.chat_formatting import pagify, box
|
||||||
|
|
||||||
DEFAULT_MESSAGES = [
|
DEFAULT_MESSAGES = [
|
||||||
# "Example message. Uncomment and overwrite to use"
|
# "Example message. Uncomment and overwrite to use",
|
||||||
|
# "Example message 2. Each message is in quotes and separated by a comma"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -52,13 +51,13 @@ class AnnounceDaily:
|
|||||||
Do `[p]help annd <subcommand>` for more details
|
Do `[p]help annd <subcommand>` for more details
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await ctx.send_help()
|
pass
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.guildowner()
|
@checks.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def runannounce(self, ctx: commands.Context):
|
async def runannounce(self, ctx: commands.Context):
|
||||||
"""Trigger the daily announcement"""
|
"""Manually run the daily announcement"""
|
||||||
|
|
||||||
await self.send_announcements()
|
await self.send_announcements()
|
||||||
await ctx.send("Success")
|
await ctx.send("Success")
|
||||||
@ -174,13 +173,13 @@ class AnnounceDaily:
|
|||||||
await ctx.send("Successfully removed {}".format(filename))
|
await ctx.send("Successfully removed {}".format(filename))
|
||||||
|
|
||||||
@_ad.command()
|
@_ad.command()
|
||||||
async def settime(self, ctx: commands.Context, minutes: int):
|
async def settime(self, ctx: commands.Context, minutes_from_now: int):
|
||||||
"""
|
"""
|
||||||
Set the daily announcement time
|
Set the daily announcement time
|
||||||
|
|
||||||
It will first announce at the time you provided, then it will repeat every 24 hours
|
It will first announce at the time you provided, then it will repeat every 24 hours
|
||||||
"""
|
"""
|
||||||
ann_time = datetime.now() + timedelta(minutes=minutes)
|
ann_time = datetime.now() + timedelta(minutes=minutes_from_now)
|
||||||
|
|
||||||
h = ann_time.hour
|
h = ann_time.hour
|
||||||
m = ann_time.minute
|
m = ann_time.minute
|
||||||
@ -188,7 +187,7 @@ class AnnounceDaily:
|
|||||||
await self.config.time.set({'hour': h, 'minute': m, 'second': s})
|
await self.config.time.set({'hour': h, 'minute': m, 'second': s})
|
||||||
|
|
||||||
await ctx.send("Announcements time has been set to {}::{}::{} every day\n"
|
await ctx.send("Announcements time has been set to {}::{}::{} every day\n"
|
||||||
"Changes will apply after next announcement or reload".format(h, m, s))
|
"**Changes will apply after next scheduled announcement or reload**".format(h, m, s))
|
||||||
|
|
||||||
async def send_announcements(self):
|
async def send_announcements(self):
|
||||||
messages = await self._get_msgs()
|
messages = await self._get_msgs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user