Ph bot answer

Hey bro ı need help
Question:K[Guard]'a Cevap Olarak 5lk69ka Yazınız.
Reply: 5lk69ka

5lk69ka this section is constantly changing.
How do we edit these codes?
Or can you code it?
Thx <3

from phBot import *
import phBotChat
import struct
import json
import os
import time

def handle_joymax(opcode, data):

if opcode == 0x3026: # Chat Message
    # Packet index
    index = 0
    # Message type: All or Party or Private
    if data[index] == 0x01 or data[index] == 0x02 or data[index] == 0x04:
        # Parse nick of character
        Character = "[KGuard]"
        if data[index] != 0x01:
            index += 1
            CharacterLength = struct.unpack_from('<H', data, index)[0]
            index += 2
            Character = struct.unpack_from('<' + str(CharacterLength) + 's', data, index)[0].decode('cp1252')
            index += CharacterLength
        if Character == "[KGuard]":
             # Load and search command message
             MessageLength = struct.unpack_from('<H', data, index)[0]
             index += 2
             Message = struct.unpack_from('<' + str(MessageLength * (2 if get_encoding() == 'utf-16le' else 1)) + 's', data, index)[0].decode(get_encoding())
             if "K[Guard]'a Cevap Olarak" in Message: # soru geliyor
                cevap = ""
                for c in reversed(Message):
                    if c != "k":
                        cevap += c
                cevap = cevap[::-1].replace("", "")
                qeqo = "" + cevap.strip()
                Packet = bytearray()
                Packet = Packet + struct.pack('<H', len(qeqo))
                Packet = Packet + qeqo.encode('ascii')
                inject_joymax(0x7025, Packet, False)
return True

log(‘NfSRO Soru Cevap Aktif Edildi’)

1 Like

try this, or edit to your necessities!

from phBot import *
import phBotChat
from time import sleep
import re

log("Plugin: KGuard successfully loaded.")

def handle_chat(t, player, msg):
	if len(player) > 0:
		if player == "[KGuard]":
			# using regular expression
			if'Cevap Olarak [a-zA-Z0-9]* Yazınız',msg):
				# extracting answer
				reply ='Cevap Olarak ([a-zA-Z0-9]*) Yazınız',msg)[1]
				# reply the answer

From KGuard to [KGuard]. You can edit that, c’mon! ._.
Fixed anyways.

1 Like

[13:24:41] Plugin: KGuard successfully loaded. But , He doesn’t answer the question.Can’t edit it with the codes I scored above??