Skip to content

Commit

Permalink
Merge pull request #2181 from sopel-irc/unset_tz
Browse files Browse the repository at this point in the history
clock: add unset functionality
  • Loading branch information
dgw authored Nov 7, 2021
2 parents 9b8d923 + a3bb073 commit 4a97936
Showing 1 changed file with 38 additions and 0 deletions.
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

0 comments on commit 4a97936

Please sign in to comment.