@@ -9,18 +9,8 @@ public class SayCommand : ICommand
99
1010 public ( bool handled , string response ) Process ( BotContext ctx , string senderNick , string message , string fullLine )
1111 {
12- if ( ! message . StartsWith ( "!say" ) )
13- return ( false , null ) ;
14-
15- if ( ! ctx . Admins . Contains ( senderNick ) )
16- return ( true , "You must be an admin to use say commands." ) ;
17-
18- if ( message . StartsWith ( "!sayto " ) )
19- return HandleSayTo ( ctx , senderNick , message ) ;
20-
21- if ( message . StartsWith ( "!say " ) )
22- return HandleSay ( ctx , senderNick , message ) ;
23-
12+ // !say and !sayto are Discord-only commands (Discord ? IRC only)
13+ // Not available from IRC channel
2414 return ( false , null ) ;
2515 }
2616
@@ -37,35 +27,32 @@ public bool TryHandleDiscordSay(BotContext ctx, string message)
3727 return false ;
3828
3929 ctx . Writer ? . WriteLine ( $ "PRIVMSG { ctx . Channel } :{ text } ") ;
30+ ctx . Logger ? . Log ( $ "[DISCORD SAY] { text } ") ;
4031 return true ;
4132 }
4233
43- private ( bool , string ) HandleSay ( BotContext ctx , string senderNick , string message )
34+ public bool TryHandleDiscordSayTo ( BotContext ctx , string message )
4435 {
45- if ( message . Length <= 5 )
46- return ( true , "Usage: !say <message>" ) ;
47-
48- string text = message . Substring ( 5 ) . Trim ( ) ;
49- if ( string . IsNullOrWhiteSpace ( text ) )
50- return ( true , "Usage: !say <message>" ) ;
36+ if ( ! message . StartsWith ( "!sayto " ) )
37+ return false ;
5138
52- ctx . Logger ? . Log ( $ "[SAY] { senderNick } said: { text } ") ;
53- return ( true , text ) ;
54- }
39+ if ( ! ctx . RelayDiscordToIrc )
40+ return false ;
5541
56- private ( bool , string ) HandleSayTo ( BotContext ctx , string senderNick , string message )
57- {
5842 var parts = message . Split ( ' ' , StringSplitOptions . RemoveEmptyEntries ) ;
5943 if ( parts . Length < 3 )
60- return ( true , "Usage: !sayto <nick> <message>" ) ;
44+ return false ;
6145
6246 string targetNick = parts [ 1 ] ;
6347 string text = string . Join ( " " , parts . Skip ( 2 ) ) ;
48+ if ( string . IsNullOrWhiteSpace ( text ) )
49+ return false ;
6450
6551 ctx . Writer ? . WriteLine ( $ "PRIVMSG { targetNick } :{ text } ") ;
66- ctx . Logger ? . Log ( $ "[SAYTO] { senderNick } sent PM to { targetNick } : { text } ") ;
67- return ( false , null ) ;
52+ ctx . Logger ? . Log ( $ "[DISCORD SAYTO] Sent PM to { targetNick } : { text } ") ;
53+ return true ;
6854 }
6955 }
7056}
7157
58+
0 commit comments