Skip to content

Commit 4a97936

Browse files
authored
Merge pull request #2181 from sopel-irc/unset_tz
clock: add unset functionality
2 parents 9b8d923 + a3bb073 commit 4a97936

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

sopel/modules/clock.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ def update_user(bot, trigger):
159159
bot.reply('I now have you in the %s timezone.' % zone)
160160

161161

162+
@plugin.command('unsettz', 'unsettimezone')
163+
@plugin.example('.unsettz')
164+
def unset_user_tz(bot, trigger):
165+
"""Unset your preferred timezone."""
166+
bot.db.delete_nick_value(trigger.nick, 'timezone')
167+
bot.reply('Successfully unset timezone')
168+
169+
162170
@plugin.command('gettz', 'gettimezone')
163171
@plugin.example('.gettz Exirel', user_help=True)
164172
@plugin.example('.gettz', user_help=True)
@@ -216,6 +224,14 @@ def update_user_format(bot, trigger):
216224
% (timef, set_command))
217225

218226

227+
@plugin.command('unsettimeformat', 'unsettf')
228+
@plugin.example('.unsettf')
229+
def unset_user_format(bot, trigger):
230+
"""Unsets your preferred format for time."""
231+
bot.db.delete_nick_value(trigger.nick, 'time_format')
232+
bot.reply('Successfully unset time format')
233+
234+
219235
@plugin.command('gettimeformat', 'gettf')
220236
@plugin.example('.gettf Exirel', user_help=True)
221237
@plugin.example('.gettf', user_help=True)
@@ -268,6 +284,17 @@ def update_channel(bot, trigger):
268284
bot.reply('I now have %s in the %s timezone.' % (channel, zone))
269285

270286

287+
@plugin.command('unsetchanneltz', 'unsetctz')
288+
@plugin.example('.unsetctz')
289+
@plugin.require_chanmsg
290+
@plugin.require_privilege(plugin.OP, message='Changing the channel timezone requires OP privileges.')
291+
def unset_channel(bot, trigger):
292+
"""Unset the preferred timezone for the current channel."""
293+
channel = trigger.sender
294+
bot.db.delete_channel_value(channel, 'timezone')
295+
bot.reply('Successfully unset channel timezone')
296+
297+
271298
@plugin.command('getchanneltz', 'getctz')
272299
@plugin.example('.getctz #sopel', user_help=True)
273300
@plugin.example('.getctz', user_help=True)
@@ -332,6 +359,17 @@ def update_channel_format(bot, trigger):
332359
"commands)" % (timef, set_command, channel_command))
333360

334361

362+
@plugin.command('unsetchanneltimeformat', 'unsetctf')
363+
@plugin.example('.unsetctf')
364+
@plugin.require_chanmsg
365+
@plugin.require_privilege(plugin.OP, message='Changing the channel time format requires OP privileges.')
366+
def unset_channel_format(bot, trigger):
367+
"""Unset the preferred time format for the current channel."""
368+
channel = trigger.sender
369+
bot.db.delete_channel_value(channel, 'time_format')
370+
bot.reply('Successfully unset channel time format')
371+
372+
335373
@plugin.command('getchanneltimeformat', 'getctf')
336374
@plugin.example('.getctf #sopel', user_help=True)
337375
@plugin.example('.getctf', user_help=True)

0 commit comments

Comments
 (0)