diff options
| author | ailin-nemui | 2017-04-12 09:32:15 +0200 | 
|---|---|---|
| committer | GitHub | 2017-04-12 09:32:15 +0200 | 
| commit | fa6ab59ba18c61f471f7471d9866772ee8d08e84 (patch) | |
| tree | 8cc9b30095ec9198003b86dc4c313ae046a7caf5 | |
| parent | e96d7d23747e7eb3d882b31c45c3e1dbf58e43c4 (diff) | |
| parent | 7e3bf55cc6923cd7eec478c04a2ae03a2b547aae (diff) | |
| download | scripts.irssi.org-fa6ab59ba18c61f471f7471d9866772ee8d08e84.tar.bz2 | |
Merge pull request #397 from GeneralUnRest/master
updated fullwidth
| -rw-r--r-- | scripts/fullwidth.pl | 33 | 
1 files changed, 30 insertions, 3 deletions
| diff --git a/scripts/fullwidth.pl b/scripts/fullwidth.pl index 261aa5a..4d17b70 100644 --- a/scripts/fullwidth.pl +++ b/scripts/fullwidth.pl @@ -14,8 +14,8 @@  # limitations under the License.  use strict; -use Irssi qw(command_bind active_win); -our $VERSION = '1.1.0'; +use Irssi qw(command_bind active_win signal_stop); +our $VERSION = '1.2.0';  our %IRSSI = (      authors     => 'prussian',      contact     => 'genunrest@gmail.com', @@ -25,7 +25,15 @@ our %IRSSI = (      license     => 'Apache 2.0',  ); -command_bind(fullwidth => sub { +my $help = '/fullwidth your cool text here +-> your cool text here + +you can also use stars to only fullwidth text between them + +/fullwidth do *you* know *the* way *to* San *Jose* +-> do you know the way to San Jose'; + +sub fullwidth {      my $msg = $_[0];      my $say = "";      foreach my $char (split //, $msg) { @@ -39,5 +47,24 @@ command_bind(fullwidth => sub {              }          }      } +    return $say; +} + +command_bind(fullwidth => sub { +    my $arg = $_[0]; +    my $say = ''; +    if ($arg =~ /\*[^*]*\*/) { +        $say = $_[0] =~ s/\*([^*]*)\*/fullwidth($1)/reg; +    } +    else { +        $say = fullwidth($arg); +    }      active_win->command("say $say");  }); + +command_bind(help => sub { +    if ($_[0] eq $IRSSI{name}) { +        Irssi::print($help, MSGLEVEL_CLIENTCRAP); +        signal_stop(); +    } +}); | 
