File size: 989 Bytes
c01079c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
import subprocess
import sys
import os

st.set_page_config(page_title="Gojo Satoru Bot", layout="centered")
st.title("Gojo Satoru Telegram Bot")

st.markdown("### Installing requirements.txt ...")
with st.spinner("Installing..."):
    try:
        # Install packages
        subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
        st.success("Requirements installed successfully.")
    except subprocess.CalledProcessError as e:
        st.error(f"Failed to install requirements: {e}")
        st.stop()

st.markdown("### Running `python -m powers` ...")
with st.spinner("Launching bot..."):
    try:
        result = subprocess.run(
            [sys.executable, "-m", "powers"],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )
        st.code(result.stdout + result.stderr, language='bash')
    except Exception as e:
        st.error(f"Failed to start the bot: {e}")