CTCP raw protocol ACTION command c in c #

I did a bot to connect to irc for punches and giggles, and I did it in response to different things, but I would like it to respond with the CTCP ACTION command, this is usually known to the user as / me is used to play roles or display actions.

according to this great ctcp webpage http://www.irchelp.org/irchelp/rfc/ctcpspec.html ?

format \ 001ACTION barfs on the floor. \ 001

so I installed my bot to answer

writer.WriteLine("PRIVMSG " + CHANNEL + " \001ACTION " + message + "\001"); 

I will print this result on my console as well, all it answers is "There is no text to send"

who doesn't really know what it means to tell me, I guess the escape character breaks the line early when \ 0 completely ignores the other 01 after it, so I have a bot print on the console, whatever it reads and I type / dances me and I read in the console

PRIVMSG CHANNEL: (odd character) ACTION message (odd character) I don’t know what the odd characters are, but to me they look like emoticons ... after talking with several people, I understand that the format is correct, but \ 001 may differ for different languages

so I see what \ 001 can mean for C # and I fin \ x01 and \ 0011, and \ 0011 does nothing, and \ x01 also returns the same answer to me .... "There is no text to send"

I print "PRIVMSG" + CHANNEL + "\ x01ACTION" + message + "\ x01" to my console, and I \ x01 is replaced by the same emoticon face that it shows when I type / dances me and the bot prints that what he reads on the console ...

my code is just for him

  if (type == MessageType.ActionMessage) { writer.WriteLine("PRIVMSG " + CHANNEL + " \x01ACTION " + message + "\x01"); Console.WriteLine("PRIVMSG " + CHANNEL + " \x01ACTION " + message + "\x01"); writer.Flush(); } 

the recording object is not null, and writing it to my console means that I see what is happening

The final question is whether this is correct, and if that is not what is the right way to show the action using the C # client on the CTCP client protocol

+6
source share
2 answers

I finally realized that \ x01 is the correct escape character for \ 001, but \ x01 is hexadecimal and the escape characters are 2 soooo bytes ..... \ x01AC is a valid escape character .... so I either had to do it \ 0001, or the escape character in its own line "\ x01" + "ACTION action struff \ x01" so that the compiler or w / e processes it, does not allow errors A and C as part of the escape character

C escape characters have 1 byte, so \ 001 or \ x01 will not be part of A and C ....

+11
source

Here is the syntax of the PRIVMSG :

PRIVMSG target :Here is your message

You probably just forgot : which is the separator for the start of the message, which explains the error No text to send .

+1
source

Source: https://habr.com/ru/post/943813/


All Articles