Here is my script. When I click the Start Shillbots… · The Chat Archive
Explore / Programming o1-mini-2024-09-12 · OpenAI WildChat-4.8M (AI2)Here is my script. When I click the Start Shillbots button, what external python script… Save Share Download ▾ ReportHere is my script. When I click the Start Shillbots button, what external python script is launched?
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, Filters, ConversationHandler, CallbackContext
import subprocess
import json
from ChangeSpeed import change_time_values
(ASK_PASSWORD, PASSWORD_VERIFICATION, DASHBOARD, ASK_LINK, ASK_TOKEN, ASK_SET_NUMBER, ASK_MIN_MAX_TIME,
ASK_IMAGE_COUNT, ASK_STICKER_COUNT, ASK_LONG_COMMAND_COUNT, ASK_MEME_PUMP_COMMAND_COUNT) = range(11)
CORRECT_PASSWORD = "Toshi"
def is_script_running(script_name):
try:
output = subprocess.check_output(['pgrep', '-f', script_name]).decode('utf-8')
return bool(output.strip())
except subprocess.CalledProcessError:
return False
def get_current_token_set(context):
with open("WhichSet.json", "r") as file:
which_set_data = json.load(file)
current_set = int(which_set_data["Set"])
return current_set
def update_current_set(set_number):
with open("WhichSet.json", "w") as file:
json.dump({"Set": str(set_number)}, file)
def start_script(script_name, token_name, folder=None, arguments=None, venv_name=None):
try:
#input(f'{folder}')
script_path = script_name if folder is None else f"{folder}/{script_name}"
if venv_name:
venv_activate = f"source {folder}/{venv_name}/bin/activate"
command_prefix = f'{venv_activate} && '
command_suffix = '; deactivate'
else:
command_prefix = ''
command_suffix = ''
if arguments:
arg_list = [str(arg) for arg in arguments]
command = f'{command_prefix}python3 {script_path} {" ".join(arg_list)}{command_suffix}'
else:
command = f'{command_prefix}python3 {script_path}{command_suffix}'
subprocess.call(['gnome-terminal', '--', 'bash', '-c', f'{command}; read -p "Press Enter to continue..."'])
return f"{token_name} started in a new terminal window successfully."
except Exception as e:
return f"Failed to start {token_name} in a new terminal window: {e}"
def kill_script(script_name, token_name, folder=None):
try:
script_path = script_name if folder is None else f"{folder}/{script_name}"
subprocess.run(['pkill', '-f', script_path], check=True)
return f"{token_name} killed successfully."
except subprocess.CalledProcessError:
return f"Failed to kill {token_name} or it was not running."
def start(update: Update, context):
update.message.reply_text("PLEASE ENTER PASSWORD")
return ASK_PASSWORD
def verify_password(update: Update, context):
entered_password = update.message.text
if entered_password == CORRECT_PASSWORD:
return dashboard(update, context)
else:
update.message.reply_text("Incorrect password, please try again.")
return ASK_PASSWORD
def get_current_link(current_set):
set_config_file = f"Set{current_set}Config.json"
with open(set_config_file, "r") as file:
set_config_data = json.load(file)
return set_config_data["join_group"]
Assistant2024-09-27 04:51 UTC Copy response
When you click the "Start Shillbots" button in your Telegram bot, the following sequence of actions occurs to launch an external Python script:
Copy first prompt
Details
Model o1-mini-2024-09-12
Provider OpenAI
Model provenance As recorded by source dataset
Turns 1 (2 messages)
Language en
Conversation date Sep 27, 2024
Added to archive Nov 16, 2026
ID 01m7h41vyd32svfke769x3d7ymSource & license Imported from WildChat-4.8M (AI2) (source ). Imported records earn no Research Points.
Upstream record: 73db18b583191026424a5d30b96bbc05
Zhao et al., WildChat: 1M ChatGPT Interaction Logs in the Wild (ICLR 2024). Contains information from WildChat-4.8M, made available under the ODC Attribution License.
License: ODC-BY-1.0
Dataset releases Not yet included in a published release.
def get_current_token(current_set):
set_config_file = f"Set{current_set}Config.json"
with open(set_config_file, "r") as file:
set_config_data = json.load(file)
return set_config_data["token"]
def get_min_max_time(current_set):
set_config_file = f"Set{current_set}Config.json"
with open(set_config_file, "r") as file:
set_config_data = json.load(file)
return set_config_data["min_time"], set_config_data["max_time"]
def get_send_script_name(current_set):
return f"Send{current_set}.py"
def toggle_script_a1(update: Update, context):
query = update.callback_query
query.answer()
script_name = "Send2PHASING.py"
token_name = "Pepe"
folder = "/home/sypherwork/Desktop/JUNE_UPGRADE"
# Check if the script is running and toggle accordingly
if is_script_running(script_name):
message = kill_script(script_name, token_name, folder)
else:
message = start_script(script_name, token_name, folder) # No venv_name specified
context.bot.send_message(chat_id=query.message.chat_id, text=message)
return dashboard(query, context)
def toggle_script_a2(update: Update, context):
query = update.callback_query
query.answer()
script_name = "Working_AutoJoinAndListen_NeedsPyEnv.py"
token_name = "Pao"
folder = "/home/sypherwork/Desktop/JoinVC"
venv_name = "Voice" # Specify the virtual environment name
if is_script_running(script_name):
message = kill_script(script_name, token_name, folder)
else:
message = start_script(script_name, token_name, folder, venv_name=venv_name)
context.bot.send_message(chat_id=query.message.chat_id, text=message)
return dashboard(query, context)
def dashboard(update, context):
current_set = get_current_token_set(context)
current_link = get_current_link(current_set)
current_token = get_current_token(current_set)
min_time, max_time = get_min_max_time(current_set)
keyboard = [
[InlineKeyboardButton("Change Set", callback_data='change_set')],
[InlineKeyboardButton("Change Token Name", callback_data='new_script5')],
[InlineKeyboardButton("Change Group Link", callback_data='new_script4')],
[InlineKeyboardButton("Join New Group", callback_data='new_script3')],
[InlineKeyboardButton("Start Shillbots", callback_data='new_script1')],
[InlineKeyboardButton("Stop Shillbots", callback_data='new_script2')],
[InlineKeyboardButton("Change Min/Max Time", callback_data='change_min_max_time')],
[InlineKeyboardButton("Change Image Count", callback_data='change_image_count')],
[InlineKeyboardButton("Change Sticker Count", callback_data='change_sticker_count')],
[InlineKeyboardButton("Change Long Command Count", callback_data='change_long_command_count')],
[InlineKeyboardButton("Change Meme Pump Command Count", callback_data='change_meme_pump_command_count')],
[InlineKeyboardButton("Text Send ON/OFF", callback_data='toggle_script_a1')],
[InlineKeyboardButton("First 30 Voice", callback_data='toggle_script_a2')],
[InlineKeyboardButton("Toggle Script B1", callback_data='toggle_script_b1')],
[InlineKeyboardButton("Toggle Script B2", callback_data='toggle_script_b2')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
text = f'Current Set: {current_set}\nCurrent Link: {current_link}\nCurrent Token: {current_token}\nMin Time: {min_time} Seconds\nMax Time: {max_time} Seconds\n\nPlease choose:'
if update.callback_query:
query = update.callback_query
query.edit_message_text(text=text, reply_markup=reply_markup)
else:
update.message.reply_text(text=text, reply_markup=reply_markup)
return DASHBOARD
def new_script1_action(update: Update, context: CallbackContext):
query = update.callback_query
query.answer()
current_set = get_current_token_set(context=context)
send_script_name = get_send_script_name(current_set=current_set)
token_name = get_current_token(current_set=current_set)
# Determine folder path based on current_set if applicable
folder = f"/home/sypherwork/Desktop/work_after_jail/JUNE_UPGRADE" # Adjust as needed
start_message = start_script(
script_name=send_script_name,
token_name=token_name,
folder=folder,
arguments=[str(current_set)] # Pass additional arguments if necessary
)
chat_id = query.message.chat.id
context.bot.send_message(chat_id=chat_id, text=start_message)
return dashboard(update=update, context=context)
def new_script2_action(update: Update, context):
query = update.callback_query
query.answer()
current_set = get_current_token_set(context)
send_script_name = get_send_script_name(current_set)
token_name = get_current_token(current_set)
kill_message = kill_script(send_script_name, token_name)
context.bot.send_message(chat_id=query.message.chat_id, text=kill_message)
return dashboard(query, context)
def new_script3_action(update: Update, context):
query = update.callback_query
query.answer()
current_set = get_current_token_set(context)
token_name = get_current_token(current_set)
start_message = start_script('join_groups.py', token_name, [current_set])
context.bot.send_message(chat_id=query.message.chat_id, text=start_message)
return dashboard(query, context)
def new_script4_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the new target group link:")
return ASK_LINK
def new_script5_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the token:")
return ASK_TOKEN
def change_set_action(update: Update, context):
query = update.callback_query
query.answer()
keyboard = [
[InlineKeyboardButton("Demo Room", callback_data='set_1')],
[InlineKeyboardButton("Set 2", callback_data='set_2')],
[InlineKeyboardButton("Set 3", callback_data='set_3')],
[InlineKeyboardButton("Set 4", callback_data='set_4')],
[InlineKeyboardButton("Set 5", callback_data='set_5')],
[InlineKeyboardButton("Set 6", callback_data='set_6')],
[InlineKeyboardButton("Set 7", callback_data='set_7')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
context.bot.send_message(chat_id=query.message.chat_id, text="Select a set:", reply_markup=reply_markup)
return ASK_SET_NUMBER
def handle_set_selection(update: Update, context):
query = update.callback_query
query.answer()
selected_set = int(query.data.split('_')[1])
update_current_set(selected_set)
context.bot.send_message(chat_id=query.message.chat_id, text=f"Switched to Set {selected_set}")
new_update = Update(update_id=update.update_id, callback_query=query)
return dashboard(new_update, context)
def handle_link_input(update: Update, context):
link = update.message.text
current_set = get_current_token_set(context)
start_message = start_script(
script_name='change_url.py',
token_name='Change URL',
arguments=[link, current_set] # Explicitly specifying 'arguments'
)
context.bot.send_message(chat_id=update.message.chat_id, text=start_message)
return dashboard(update, context)
def handle_token_input(update: Update, context):
token = update.message.text
current_set = get_current_token_set(context)
start_message = start_script(
script_name='change_token.py',
token_name='Change Token',
arguments=[token, current_set] # Explicitly specifying 'arguments'
)
context.bot.send_message(chat_id=update.message.chat_id, text=start_message)
return dashboard(update, context)
def change_min_max_time_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the new min_time and max_time values separated by a space:")
return ASK_MIN_MAX_TIME
def handle_min_max_time_input(update: Update, context):
values = update.message.text.split()
if len(values) == 2:
min_time, max_time = values
current_set = get_current_token_set(context)
change_message = change_time_values(min_time, max_time, current_set)
context.bot.send_message(chat_id=update.message.chat_id, text=change_message)
else:
context.bot.send_message(chat_id=update.message.chat_id, text="Invalid input. Please provide min_time and max_time values separated by a space.")
return dashboard(update, context)
def start_action(update: Update, context):
query = update.callback_query
query.answer()
current_set = get_current_token_set(context)
send_script_name = get_send_script_name(current_set)
start_message = start_script(send_script_name, str(current_set))
context.bot.send_message(chat_id=query.message.chat_id, text=start_message)
return dashboard(query, context)
def stop_action(update: Update, context):
query = update.callback_query
query.answer()
current_set = get_current_token_set(context)
send_script_name = get_send_script_name(current_set)
token_name = get_current_token(current_set)
kill_message = kill_script(send_script_name, token_name)
context.bot.send_message(chat_id=query.message.chat_id, text=kill_message)
return dashboard(query, context)
def toggle_script(update: Update, context):
query = update.callback_query
query.answer()
return dashboard(update, context)
def cancel(update: Update, context):
update.message.reply_text('Operation cancelled.')
return ConversationHandler.END
def change_image_count_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the new image count (default is 250):")
return ASK_IMAGE_COUNT
def change_sticker_count_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the new sticker count (default is 200):")
return ASK_STICKER_COUNT
def change_long_command_count_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the new long command count (default is 1):")
return ASK_LONG_COMMAND_COUNT
def change_meme_pump_command_count_action(update: Update, context):
query = update.callback_query
query.answer()
context.bot.send_message(chat_id=query.message.chat_id, text="Please provide the new meme pump command count between 0 and 1 (default is 0.3):")
return ASK_MEME_PUMP_COMMAND_COUNT
def handle_image_count_input(update: Update, context):
count = update.message.text
current_set = get_current_token_set(context)
change_message = change_config_value('image_count', count, current_set)
context.bot.send_message(chat_id=update.message.chat_id, text=change_message)
return dashboard(update, context)
def handle_sticker_count_input(update: Update, context):
count = update.message.text
current_set = get_current_token_set(context)
change_message = change_config_value('sticker_count', count, current_set)
context.bot.send_message(chat_id=update.message.chat_id, text=change_message)
return dashboard(update, context)
def handle_long_command_count_input(update: Update, context):
count = update.message.text
current_set = get_current_token_set(context)
change_message = change_config_value('long_command_count', count, current_set)
context.bot.send_message(chat_id=update.message.chat_id, text=change_message)
return dashboard(update, context)
def handle_meme_pump_command_count_input(update: Update, context):
count = update.message.text
current_set = get_current_token_set(context)
change_message = change_config_value('meme_pump_command_count', count, current_set)
context.bot.send_message(chat_id=update.message.chat_id, text=change_message)
return dashboard(update, context)
def change_config_value(key, value, current_set):
config_file = f"Set{current_set}Config.json"
with open(config_file, "r") as file:
config = json.load(file)
try:
if key in ['image_count', 'sticker_count', 'long_command_count']:
config[key] = int(value)
elif key == 'meme_pump_command_count':
config[key] = float(value)
else:
return f"Invalid key: {key}"
with open(config_file, "w") as file:
json.dump(config, file, indent=4)
return f"{key} updated successfully to {value}"
except ValueError:
return f"Invalid value for {key}. Please enter a valid number."
def main():
updater = Updater("7147189353:AAGUpPI-ENbvwkO96LfNleXlakslGWu56YY", use_context=True)
conv_handler = ConversationHandler(
entry_points=[CommandHandler('start', start)],
states={
ASK_PASSWORD: [MessageHandler(Filters.text & ~Filters.command, verify_password)],
DASHBOARD: [
CallbackQueryHandler(new_script1_action, pattern='^new_script1$'),
CallbackQueryHandler(new_script2_action, pattern='^new_script2$'),
CallbackQueryHandler(new_script3_action, pattern='^new_script3$'),
CallbackQueryHandler(new_script4_action, pattern='^new_script4$'),
CallbackQueryHandler(new_script5_action, pattern='^new_script5$'),
CallbackQueryHandler(change_set_action, pattern='^change_set$'),
CallbackQueryHandler(toggle_script, pattern='^toggle_script$'),
CallbackQueryHandler(toggle_script_a1, pattern='^toggle_script_a1$'),
CallbackQueryHandler(toggle_script_a2, pattern='^toggle_script_a2$'),
CallbackQueryHandler(change_min_max_time_action, pattern='^change_min_max_time$'),
CallbackQueryHandler(change_image_count_action, pattern='^change_image_count$'),
CallbackQueryHandler(change_sticker_count_action, pattern='^change_sticker_count$'),
CallbackQueryHandler(change_long_command_count_action, pattern='^change_long_command_count$'),
CallbackQueryHandler(change_meme_pump_command_count_action, pattern='^change_meme_pump_command_count$'),
],
ASK_LINK: [MessageHandler(Filters.text & ~Filters.command, handle_link_input)],
ASK_TOKEN: [MessageHandler(Filters.text & ~Filters.command, handle_token_input)],
ASK_SET_NUMBER: [CallbackQueryHandler(handle_set_selection, pattern='^set_\d+$')],
ASK_MIN_MAX_TIME: [MessageHandler(Filters.text & ~Filters.command, handle_min_max_time_input)],
ASK_IMAGE_COUNT: [MessageHandler(Filters.text & ~Filters.command, handle_image_count_input)],
ASK_STICKER_COUNT: [MessageHandler(Filters.text & ~Filters.command, handle_sticker_count_input)],
ASK_LONG_COMMAND_COUNT: [MessageHandler(Filters.text & ~Filters.command, handle_long_command_count_input)],
ASK_MEME_PUMP_COMMAND_COUNT: [MessageHandler(Filters.text & ~Filters.command, handle_meme_pump_command_count_input)],
},
fallbacks=[CommandHandler('cancel', cancel)],
allow_reentry=True
)
updater.dispatcher.add_handler(conv_handler)
updater.dispatcher.add_handler(CallbackQueryHandler(start_action, pattern='^start_action$'))
updater.dispatcher.add_handler(CallbackQueryHandler(stop_action, pattern='^stop_action$'))
updater.start_polling()
updater.idle()
if name == 'main ':
main()
Determine the Current Set:
The bot reads the WhichSet.json file to determine the current set number (current_set).
Example content of WhichSet.json:
{
"Set": "2"
}
In this example, current_set would be 2.
Construct the Script Name:
Based on the current_set, the script name is dynamically constructed.
For current_set = 2, the script name becomes Send2.py.
Specify the Script Location:
Launch the Script in a New Terminal:
User Feedback:
Summary Clicking the "Start Shillbots" button triggers the Telegram bot to execute an external Python script named SendX.py (where X corresponds to the current set number defined in WhichSet.json). This script is located in the /home/sypherwork/Desktop/work_after_jail/JUNE_UPGRADE directory and is launched in a new GNOME Terminal window with the current set number passed as an argument.
For example, if the current set is 2, the bot will run:
python3 /home/sypherwork/Desktop/work_after_jail/JUNE_UPGRADE/Send2.py 2
This setup allows you to manage and run different scripts based on the current configuration dynamically.
Copy first response