[Plugin] triviaBot Plugin (working with pearl and xeon)

Hi everyone firstly my english and coding is not very good so I may have mistakes.

This plugin uses for answer to chat event.
For those who do not know this event: [BOT]Events asks question from global and if you answer correctly with a pm, you win 25 silk.

Plugin automatically adds questions, no need manual typing.
Only tested in Pearl sro.
You just drag to the plugins folder and wait for the questions to save.

Here is plugin
https://raw.githubusercontent.com/ayhtyu/phBotPlugin/master/triviaBot.py
Dont forget to change server variable in triviaBot.py file

3 Likes

it work with all serverā€™s or just only Pearl sro?

I havenā€™t tried any other server but maybe it can work with minor changes

itā€™s dosnā€™t work on Electus server no have any reaction

it didnt work on Xeon server too,
no react
in xeon server the bot name is [BOT]
is that may consider a problem ?

so the plugin was working perfectly the last 2 months in XEON
until a new update came to the server , basically the new update change the way that sending the questing

the questions was sending in globals

but now, its sending by Notice

i tried to edit the bot by changing t ==7 instead of t ==1 and deleted the line where if player == [BOT]

and i re wrote it as :

elif server == ā€œxeonā€:
if ā€œwinner of this roundā€ not in msg and ā€œno winner for thisā€ not in msg:
a = 0
while True:
if a == get_qa(ā€˜lā€™,0):
save_q2_cache(msg) # save question if dont know
Timer(randrange(30,80), add_newq, ()).start() # automatically add questions to qafile and gui list
break
else:
if get_qa(ā€˜qā€™,a) == msg:
player == ā€œ[BOT]ā€
reply = get_qa(ā€˜aā€™,a)
Timer(randrange(answertime[0],answertime[1]), phBotChat.Private, (player,reply)).start()
log(ā€œtriviaBot: [ā€+msg+"] question replied as ["+reply+"]")
break
a += 1

it didnt work could u update it or at least help me how could i fix the error ?

Updated the plugin for XEON:
and its working fine now ā€¦

https://raw.githubusercontent.com/Mo7ammadQ8/PhBotScripts/master/trviaXEONupdate

  • increased the speed of answering

thanks ryan for : Introduction - phBot Plugins
it was really helpfulā€¦

thanks ayhtyu for : creating the plugin from scratch.

thanks JellyBitz for : your plugins because i learned few things from reading ur codes of other plugins :smiley:

Can this plugin be modified for PureSRO server?

show me the questions an example of the question how its show in globals,
and i will try if i could make it :smiley:

The questions are asked in notice and the answer should be sent as a private message to Kotsh or $Kotsh.

okay show me the kind of the question take a screen shot i should see if its asked by Notice or global ā€¦ i need more details

when event start just take screen shot for it so i could try my best

Iā€™m not home atm, but as soon as i get home after 4 hours i will take a screenshot to show you an example.

and i will tryy my best to do it :smiley:

How do you make it read globals? set t == 1?

[15:09:22] Python Error: ā€˜charmapā€™ codec canā€™t encode character ā€˜\u044eā€™ in position 28: character maps to
I get this often

Hereā€™s the image

Plugin donā€™t work anymore on XEON
Anyone can help?

Its can work for other server ?