Skip to content
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

Add .gitattributes to ensure project consistent line endings #4037

Merged
merged 1 commit into from Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
@@ -0,0 +1,4 @@
* text eol=lf

# binary file excludsions
*.png binary
82 changes: 41 additions & 41 deletions redbot/cogs/mod/slowmode.py
@@ -1,41 +1,41 @@
import re
from .abc import MixinMeta
from datetime import timedelta
from redbot.core import commands, i18n, checks
from redbot.core.utils.chat_formatting import humanize_timedelta
_ = i18n.Translator("Mod", __file__)
class Slowmode(MixinMeta):
"""
Commands regarding channel slowmode management.
"""
@commands.command()
@commands.guild_only()
@commands.bot_has_permissions(manage_channels=True)
@checks.admin_or_permissions(manage_channels=True)
async def slowmode(
self,
ctx,
*,
interval: commands.TimedeltaConverter(
minimum=timedelta(seconds=0), maximum=timedelta(hours=6), default_unit="seconds"
) = timedelta(seconds=0),
):
"""Changes channel's slowmode setting.
Interval can be anything from 0 seconds to 6 hours.
Use without parameters to disable.
"""
seconds = interval.total_seconds()
await ctx.channel.edit(slowmode_delay=seconds)
if seconds > 0:
await ctx.send(
_("Slowmode interval is now {interval}.").format(
interval=humanize_timedelta(timedelta=interval)
)
)
else:
await ctx.send(_("Slowmode has been disabled."))
import re
from .abc import MixinMeta
from datetime import timedelta
from redbot.core import commands, i18n, checks
from redbot.core.utils.chat_formatting import humanize_timedelta

_ = i18n.Translator("Mod", __file__)


class Slowmode(MixinMeta):
"""
Commands regarding channel slowmode management.
"""

@commands.command()
@commands.guild_only()
@commands.bot_has_permissions(manage_channels=True)
@checks.admin_or_permissions(manage_channels=True)
async def slowmode(
self,
ctx,
*,
interval: commands.TimedeltaConverter(
minimum=timedelta(seconds=0), maximum=timedelta(hours=6), default_unit="seconds"
) = timedelta(seconds=0),
):
"""Changes channel's slowmode setting.

Interval can be anything from 0 seconds to 6 hours.
Use without parameters to disable.
"""
seconds = interval.total_seconds()
await ctx.channel.edit(slowmode_delay=seconds)
if seconds > 0:
await ctx.send(
_("Slowmode interval is now {interval}.").format(
interval=humanize_timedelta(timedelta=interval)
)
)
else:
await ctx.send(_("Slowmode has been disabled."))