thanks for pointing out the mistake. I found the problem. I was doing the following very simple calculation in python
int(merkle_root,16) % tickets
with the merkle root above and tickets = 1333
the correct result is 469, but python only finds that when tickets is an int. Hoever in my code tickets was assumed to be a float.
Ususally this is no problem but it causes python to use a numerical result that eventually fails for very big numbers. In this case python tells me that
533185083072510277447466028633619559836558615818 % 1333 = 469
while
533185083072510277447466028633619559836558615818 % 1333. = 1052
I have now fixed the bug. The old way was still random, but I am not sure it was fair (in the way that all tickets were equally likely to win).
I also changed the way the bot presents the result to make it more understandable what happens.