]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
updated fullwidth
authoradedomin <redacted>
Wed, 12 Apr 2017 02:11:42 +0000 (22:11 -0400)
committeradedomin <redacted>
Wed, 12 Apr 2017 02:11:42 +0000 (22:11 -0400)
scripts/fullwidth.pl

index 261aa5acba751f8f4f43b65dbb19c64421b30d85..4d17b70bc4704ea8294a157b38cf31f4d6f9a6e4 100644 (file)
@@ -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();
+    }
+});
git clone https://git.99rst.org/PROJECT