Coder Social home page Coder Social logo

Comments (10)

serangelicloud avatar serangelicloud commented on July 19, 2024 1

oh.. that was funny, thank you
sorry for disturbing :D

from hcclient.

AnnikaV9 avatar AnnikaV9 commented on July 19, 2024

The message string is handled by send_input()

def send_input(self, message: str) -> None:

Note that this function also processes commands, so you'll want to make sure your encryption is done after the function has checked if the string is not a command and meant to be a message. This is the line that finally sends a regular chat message:

self.send(json.dumps({"cmd": "chat", "text": message}))

Also make sure to check if the message begins with a / anyway, since we pass some commands like /whisper and /me to the server to handle.

Feel free to ask anything else :D

from hcclient.

serangelicloud avatar serangelicloud commented on July 19, 2024

ok so i was doing a test trying to see if i could mess with the string by adding a dot at the end but apparently it's not working.
self.send(json.dumps({"cmd": "chat", "text": f"{message}."}))`

any suggestions?

from hcclient.

AnnikaV9 avatar AnnikaV9 commented on July 19, 2024

Hmm, not sure why it isn't working for you. I've tested on my side and it does append a period to messages.

message.mp4

from hcclient.

serangelicloud avatar serangelicloud commented on July 19, 2024

Can you share the full code you've used?

from hcclient.

AnnikaV9 avatar AnnikaV9 commented on July 19, 2024

I modified this snippet:

case _:
if self.whisper_lock:
if not message.split(" ")[0] in ("/whisper", "/w", "/reply", "/r") or message.startswith(" "):
self.print_msg("{}|{}| {}".format(termcolor.colored("-NIL-", self.args["timestamp_color"]),
termcolor.colored("CLIENT", self.args["client_color"]),
termcolor.colored("Whisper lock active, toggle it off to send messages", self.args["client_color"])))
return
self.send(json.dumps({"cmd": "chat", "text": message}))

to

 case _: 
     if self.whisper_lock: 
         if not message.split(" ")[0] in ("/whisper", "/w", "/reply", "/r") or message.startswith(" "): 
             self.print_msg("{}|{}| {}".format(termcolor.colored("-NIL-", self.args["timestamp_color"]), 
                                               termcolor.colored("CLIENT", self.args["client_color"]), 
                                               termcolor.colored("Whisper lock active, toggle it off to send messages", self.args["client_color"]))) 
             return 
  
     self.send(json.dumps({"cmd": "chat", "text": f"{message}."})) 

The change is at line 949 specifically

(There have been a few commits adding unrelated stuff, so the line number isn't the same as before)

from hcclient.

AnnikaV9 avatar AnnikaV9 commented on July 19, 2024

Can you fork and add your changes so I can see your code? I'm puzzled as to why it doesn't add a period for you.

from hcclient.

serangelicloud avatar serangelicloud commented on July 19, 2024

done.

from hcclient.

AnnikaV9 avatar AnnikaV9 commented on July 19, 2024

Just tested, works as expected. Are you maybe accidentally testing with a different installation of hcclient? Maybe one you have installed globally

231122_21-32-55

from hcclient.

AnnikaV9 avatar AnnikaV9 commented on July 19, 2024

It's okay, glad we clarified it. Have a great day :D

from hcclient.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.