Trade Chat Answer

#1

Due to each server changing random parts of their answer you may need to modify the script to make it work.

from phBot import *
import phBotChat

import re
from time import sleep

def handle_chat(t, player, msg):
	if len(player) == 0:
		m = re.findall(r'(\d+)', msg)
		if m and len(m) >= 2:

			if msg.find('+') != -1 or msg.find(' x ') != -1:
				result = int(m[0]) + int(m[1])
			else:
				result = int(m[0]) * int(m[1])

			sleep(1.0)

			log('Sending result %s' % str(result))
			if msg.find('/answer') != -1:
				phBotChat.All('/answer ' + str(result))
			else:
				phBotChat.All(str(result))
	elif player == 'RemoLogger' or player == 'Bot' or player == 'BotCheck':
		m = re.findall(r'(\d+)', msg)
		if m:
			if len(m) == 1:

				sleep(1.0)

				log('Sending result %s' % str(m[0]))
				phBotChat.Private(player, str(m[0]))

			elif len(m) >= 2:

				if msg.find('+') != -1 or msg.find(' x ') != -1:
					result = int(m[0]) + int(m[1])
				else:
					result = int(m[0]) * int(m[1])

				sleep(1.0)

				log('Sending result %s' % str(result))
				phBotChat.Private(player, str(result))
		elif msg.lower().find('kervankey') != -1:
			sleep(1.0)
			phBotChat.Private(player, 'Kervankey')
	elif player.find('JobSecure') != -1 and msg.find('Job experience') != -1:
		sleep(1.0)
		phBotChat.Private(player, str(get_character_data()['job_current_exp']))

log('[%s] Loaded' % __name__)
"NF SRO" Trader questions
Trade Auto Answer Plugins
KERVANDA JOB lwli sorma
Kervan key
Question - About script commands
PhBot Guard
Trader question
Trade
Nfsro 120 cap
pinned #2
#3

Is this plugin answers the question if the question sended by a character by pm?

#4

Depends on the name of the player that sent the message.

#5

The character is Server (not [Server], just Server which sends the message. But there is a problem. The answer-check system is quite different.

At first you have to write a pm to Server character to this message: key , then this Server character randomly sends 7 number code to you and wants you to reply this code to it(Server character).

I hope you get what is system like. What do you prefer to solve this check method or is there any plugin which can work for that one?

#6

This may work. In your script add the command request_key where you want to send System the key message.

from phBot import *
import phBotChat

import re
from time import sleep

def request_key(args):
	phBotChat.Private('System', 'key')
	return 5

def handle_chat(t, player, msg):
	if len(player) == 0:
		m = re.findall(r'(\d+)', msg)
		if m and len(m) >= 2:

			if msg.find('+') != -1 or msg.find(' x ') != -1:
				result = int(m[0]) + int(m[1])
			else:
				result = int(m[0]) * int(m[1])

			sleep(1.0)

			log('Sending result %s' % str(result))
			if msg.find('/answer') != -1:
				phBotChat.All('/answer ' + str(result))
			else:
				phBotChat.All(str(result))
	elif player == 'RemoLogger' or player == 'Bot' or player == 'BotCheck' or player == 'System':
		m = re.findall(r'(\d+)', msg)
		if m:
			if len(m) == 1:

				sleep(1.0)

				log('Sending result %s' % str(m[0]))
				phBotChat.Private(player, str(m[0]))

			elif len(m) >= 2:

				if msg.find('+') != -1 or msg.find(' x ') != -1:
					result = int(m[0]) + int(m[1])
				else:
					result = int(m[0]) * int(m[1])

				sleep(1.0)

				log('Sending result %s' % str(result))
				phBotChat.Private(player, str(result))
		elif msg.lower().find('kervankey') != -1:
			sleep(1.0)
			phBotChat.Private(player, 'Kervankey')
	elif player.find('JobSecure') != -1:
		sleep(1.0)
		phBotChat.Private(player, str(get_character_data['job_current_exp']))

log('[%s] Loaded' % __name__)
#7

@Ryan BotCheck 1-999 Auto Answer
How can we do this?

The Mixed Number Between Pm is Coming.

#8

Post a screenshot of the message it sends.

#9

Ads%C4%B1z

#10

There are already like 10 posts about this. Get Some String data from web site

#11

@Ryan what exactly is that solutions

#12

There isn’t one at the moment.

#13

@Ryan Can’t you help?

#14

Bro Answer to Job exp question plugin is not working good at regard-online.com

#15

I can’t keep up with every implementation of the job question. You’ll have to write some code and make it work with whatever server you’re on.

1 Like
#16

Okey. Sorry… How can i learn how to make plugin and write some codes :=)

#17

Plugins.phbot.org
Read the first page
“learning python”

1 Like