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

clock: add unset functionality #2181

Merged
merged 1 commit into from
Nov 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions sopel/modules/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ def update_user(bot, trigger):
bot.reply('I now have you in the %s timezone.' % zone)


@plugin.command('unsettz', 'unsettimezone')
@plugin.example('.unsettz')
def unset_user_tz(bot, trigger):
"""Unset your preferred timezone."""
bot.db.delete_nick_value(trigger.nick, 'timezone')
bot.reply('Successfully unset timezone')


@plugin.command('gettz', 'gettimezone')
@plugin.example('.gettz Exirel', user_help=True)
@plugin.example('.gettz', user_help=True)
Expand Down Expand Up @@ -216,6 +224,14 @@ def update_user_format(bot, trigger):
% (timef, set_command))


@plugin.command('unsettimeformat', 'unsettf')
@plugin.example('.unsettf')
def unset_user_format(bot, trigger):
"""Unsets your preferred format for time."""
bot.db.delete_nick_value(trigger.nick, 'time_format')
bot.reply('Successfully unset time format')


@plugin.command('gettimeformat', 'gettf')
@plugin.example('.gettf Exirel', user_help=True)
@plugin.example('.gettf', user_help=True)
Expand Down Expand Up @@ -268,6 +284,17 @@ def update_channel(bot, trigger):
bot.reply('I now have %s in the %s timezone.' % (channel, zone))


@plugin.command('unsetchanneltz', 'unsetctz')
@plugin.example('.unsetctz')
@plugin.require_chanmsg
@plugin.require_privilege(plugin.OP, message='Changing the channel timezone requires OP privileges.')
def unset_channel(bot, trigger):
"""Unset the preferred timezone for the current channel."""
channel = trigger.sender
bot.db.delete_channel_value(channel, 'timezone')
bot.reply('Successfully unset channel timezone')


@plugin.command('getchanneltz', 'getctz')
@plugin.example('.getctz #sopel', user_help=True)
@plugin.example('.getctz', user_help=True)
Expand Down Expand Up @@ -332,6 +359,17 @@ def update_channel_format(bot, trigger):
"commands)" % (timef, set_command, channel_command))


@plugin.command('unsetchanneltimeformat', 'unsetctf')
@plugin.example('.unsetctf')
@plugin.require_chanmsg
@plugin.require_privilege(plugin.OP, message='Changing the channel time format requires OP privileges.')
def unset_channel_format(bot, trigger):
"""Unset the preferred time format for the current channel."""
channel = trigger.sender
bot.db.delete_channel_value(channel, 'time_format')
bot.reply('Successfully unset channel time format')


@plugin.command('getchanneltimeformat', 'getctf')
@plugin.example('.getctf #sopel', user_help=True)
@plugin.example('.getctf', user_help=True)
Expand Down