File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ def update_rates(bot):
250250 LOGGER .debug ('Rate update completed' )
251251
252252
253- @plugin .command ('cur' , 'currency' , 'exchange' )
253+ @plugin .commands ('cur' , 'currency' , 'exchange' )
254254@plugin .example ('.cur 100 usd in btc cad eur' ,
255255 r'100 USD is [\d\.]+ BTC, [\d\.]+ CAD, [\d\.]+ EUR' ,
256256 re = True , online = True , vcr = True )
@@ -276,3 +276,21 @@ def exchange_re(bot, trigger):
276276 if bot .config .currency .auto_convert :
277277 match = EXCHANGE_REGEX .match (trigger )
278278 exchange (bot , match )
279+
280+
281+ @plugin .command ('currencies' )
282+ @plugin .output_prefix (PLUGIN_OUTPUT_PREFIX )
283+ def supported_cmd (bot , trigger ):
284+ """List which currency codes are supported for conversion."""
285+ if not rates :
286+ try :
287+ update_rates (bot )
288+ except Exception :
289+ bot .reply ("Couldn't fetch supported currencies. Please try again later." )
290+ return
291+
292+ codes = sorted (list (rates .keys ()))
293+
294+ bot .say (
295+ "Supported currency codes: " + ' ' .join (codes ),
296+ trigger .nick , max_messages = 5 )
You can’t perform that action at this time.
0 commit comments