How To Create A Signal Room for Crash Game
Signal bot is a Telegram bot that gives random signals for crash games. The bot sends messages with information about when a player should make a bet and when to collect the winnings. The messages are sent to the partner's group or channel with a referral link attached. Here, we describe how to create a signal bot in a few simple steps.
Compiler
Firstly, you need to install a compiler - a program that allows you to write and run code. Telegram only supports the Python language, so you need to download PyCharm. After installed PyCharm, you need to create a new project. To do this, launch the compiler and select «New Project». Then specify the project location and click «Create».
After creating a project, PyCharm will offer you a template — this is an example of a program.
Main.py is the main file: it will be uploaded to the server to make the bot work around the clock. The template text should be deleted, and the red circle should be removed by pointing the mouse over it and pressing the left button.
Writing the code
Now you need to copy and paste the code.
import random
import time
import re
import telebot
from background import keep_alive
keep_alive()
image_paths = [
'1.jpg',
]
TOKEN = '6658745665:AAEsD5b4pZ1qRMtDBKq35JGypAFyF_cHLNc'
bot = telebot.TeleBot(TOKEN)
chat_id = '-1001933147627'
previous_multiplier = round(random.uniform(1.0, 1.87), 2)
def generate_crash_multiplier():
if random.random() <= 0.8:
return round(random.uniform(1.3, 2.5), 2)
else:
return round(random.uniform(2.5, 4.0), 2)
def send_signal_with_random_image():
global previous_multiplier
global last_message
current_multiplier = generate_crash_multiplier()
full_message = (
"🎯 Enter confirmed 🎯\n"
f"📱 Site: 👉 <a href='https://1woxmv.top/v3/aviator-fire#gox7'>Click Here To Play</a>👈\n\n"
f"👉 Enter after the {previous_multiplier}х\n"
f"💰 Exit at {current_multiplier}х\n\n"
"🛟 Make up to 2 protections\n"
f"💸 <a href='https://1woxmv.top/v3/aviator-fire#gox7'>Click here to open the platform</a>"
)
previous_multiplier = current_multiplier
random_image_path = random.choice(image_paths)
with open(random_image_path, 'rb') as photo:
message = bot.send_photo(chat_id=chat_id,
photo=photo,
caption=full_message,
parse_mode='HTML')
last_message = message
def send_feedback_message():
global last_message
random_value = random.random()
pattern = r'💰 Exit at (\d+\.\d+)'
feedback_message = "test"
if re.search(pattern, last_message.caption):
extracted_float = float(re.search(pattern, last_message.caption).group(1))
feedback_message = f"✅ GREEN ({extracted_float}x)"
else:
feedback_message = "✅ GREEN"
if last_message.message_id and random_value <= 1:
bot.send_message(chat_id,
feedback_message,
reply_to_message_id=last_message.message_id)
def send_signals_periodically():
while True:
send_signal_with_random_image()
time.sleep(3 * 60)
send_feedback_message()
time.sleep(2.5 * 60)
send_signals_periodically()
Here you will notice the problem:
The red underline means that the library telebot isn’t installed yet and needs to be added.
To install Telebot:
- Point the cursor over telebot — PyCharm will immediately offer you to install the necessary library.
- Press Install or alt + shift + enter.
Done. The library is installed.
Then you will see another error.
The point here is that Python is sensitive to margins so you need to follow the relevant rules very strictly. Fortunately, PyCharm has all the needed tools to fix the issue. You need to point the cursor over the yellow underline and choose Reformat the File option from the upcoming menu.
Now all the functions work correctly, and the error is fixed. No need to replace the text underlined with green, as everything marked with # doesn’t affect the code anyway. These are remarks and commentaries to the code.
The stage of coding is over.
Creating the bot and group/channel
To create the bot, which will be implemented with your code, you need to find @Botfather in the Telegram global search.
Here, you need to enter /newbot to create a new bot.
Then create bot’s name and username — there is no need to make them totally the same.
For further programming, you need to customize the bot via API. To do this, copy the token and paste it into the TOKEN parameter.
For the bot to send signals to a group, you need its chat_id. Also, the bot must be given administrator rights.
Next, copy the number, including the minus, and paste it into the chat_id parameter in the program.
Functions
def generate_crash_multiplier() — defines the multiplier at which the player should withdraw his income, before the crash.
The function above says that 80% of the signals will be between 1.3x and 2.5x multiplier. The remaining 20% will be between 2.5x and 4x.
These values can be changed.
To set the probability, you need to insert the desired number instead of 0.8. For example, if you want 50% of the signals to be between 1.2x and 2x, and the other 50% between 2x and 10x, the code will look like this:
The probabilities can be customized in various ways. If the majority of signals will be up to 2.5, the number of wins will be greater, as these are quite real odds. If the majority of signals will be bigger than 5x, they are more likely to be losing. For a partner the second option may seem more preferable, but if a player will lose too often, he will not use such signals.
def send_signal() — generates a message with a signal.
The program takes the odd and passes it to the signal message.
A message that entry is confirmed — the program has analyzed the game and reports that the transaction will be successful.
Code with a clickable button, and the text «Click Here To Play», and an embedded link; the link and text can be changed, emoji can also be used.
Here we can give players a little tip to enter the game after the odds, for example, 1.8x — this number is also randomly generated.
The code generates a message with information on the winning odds.
Then comes a text saying it is better to make two bets at the same time, in case the player decides to wait for better odds. If you go to the aviator game page (aviator demo), you will see two betting windows. You can open several bets at the same time. One to take one at odds of 1.6x for example, and the second at 10x. But, there is also a chance of losing both.
The Code with a clickable button and a referral link.
The Code hides the link’s preset.
def send_feedback_message(): — this function automatically sends a message informing that the bet has been triggered. In order for the message to be «GREEN» for 100% of the signals, we need to put a value of 1 in random_value. random_value<=1
def send_signals_periodically() — this is the function of automatic, periodic sending of messages.
The message is sent once a minute. Since Python accepts the time parameter in seconds, the value in minutes is multiplied by 60.
A reply to the message that the bet has been triggered is sent 30 seconds after the signal is given.
Launch and Autonomy
Launching a server on Replit
Create the Main.py file and transfer here all the code from PyCharm.
After clicking RUN, the service will automatically add the needed libraries.
To make the bot autonomous, create the file Backgroud.py and add the code there.
from threading import Thread
from flask import Flask
app = Flask('')
@app.route('/')
def home():
return "I'm alive"
def run():
app.run(host='0.0.0.0', port=80)
def keep_alive():
t = Thread(target=run)
t.start()
The add this code to Main.py:
from background import keep_alive
keep_alive()
Also, the bot can attach a photo to the message. To do this, upload the needed picture to Replit. The name of the file should be exactly the same to the it in the code.
Then press RUN, so the server could install all the needed libraries.
After installing all the libraries you will receive Alive status.
Launching a monitor on UpTimerRobot
To make the script work regularly and fully autonomously, we will use UpTimerRobot service. It will sen the request to the main server and prolong its’ runtime. But first, you need to sign up:
Then you need to add a monitoring service:
Enter all the needed parameters in the upcoming window:
Monitor type : HTTP(s);
Friendly name: any
URL(or IP): a link to your server taken from Replit
Monitoring time : every 5 minutes.
Then we need to add monitoring without e-mail notifications.
Finally, we push the RUN button on Replit, and the bot starts working.