Add Railway support

pull/1/head
hikariatama 2022-08-23 19:40:25 +00:00
parent 98622ebd6a
commit 9373478391
4 changed files with 25 additions and 31 deletions

View File

@ -1,40 +1,12 @@
# Template
FROM python:3.8-slim-buster as main
# Tell Hikka, that it's running docker
# Currently it's used only in .info badge
ENV DOCKER=true
# Suppress weird gitpython error
ENV GIT_PYTHON_REFRESH=quiet
# Do not user pip cache dir
ENV PIP_NO_CACHE_DIR=1
# Install mandatory apt packages
RUN apt update && apt install \
libcairo2 git -y --no-install-recommends
# Clean the cache
RUN apt update && apt install libcairo2 git -y --no-install-recommends
RUN rm -rf /var/lib/apt/lists /var/cache/apt/archives /tmp/*
# Clone the repo
RUN git clone https://github.com/hikariatama/Hikka /Hikka
# Change working directory
WORKDIR /Hikka
# Install mandatory pip requirements
RUN pip install \
--no-warn-script-location \
--no-cache-dir \
-r requirements.txt
# Expose IP address
RUN pip install --no-warn-script-location --no-cache-dir -r requirements.txt
EXPOSE 8080
# Create data dir
RUN mkdir /data
# Run Hikka
CMD ["python3", "-m", "hikka"]

View File

@ -23,7 +23,7 @@ except ImportError as e:
try:
import redis
except ImportError as e:
if "DYNO" in os.environ:
if "DYNO" in os.environ or "RAILWAY" in os.environ:
raise e

View File

@ -57,6 +57,7 @@ TEXT_RU = """🌘🇷🇺 <b>Привет.</b> Твой юзербот <b>Hikka<
3 <b>Напиши </b><code>.dlmod &lt;ссылка&gt;</code> <b>чтобы загрузить модуль из ссылка</b>
4 <b>Напиши </b><code>.loadmod</code> <b>ответом на файл, чтобы загрузить модуль из него</b>
5 <b>Напиши </b><code>.unloadmod &lt;Название модуля&gt;</code> <b>чтобы выгрузить модуль</b>
"""
if "OKTETO" in os.environ:
@ -79,6 +80,20 @@ if "DYNO" in os.environ:
" @WebpageBot. Не блокируй его."
)
if "RAILWAY" in os.environ:
TEXT += (
"🚂 <b>Your userbot is installed on Railway</b>. This platform has only <b>500"
" free hours per month</b>. Once this limit is reached, your <b>Hikka will be"
" frozen</b>. Next month <b>you will need to go to https://railway.app and"
" restart it</b>."
)
TEXT_RU += (
"🚂 <b>Твой юзербот установлен на Railway</b>. На этой платформе ты получаешь"
" только <b>500 бесплатных часов в месяц</b>. Когда лимит будет достигнет, твой"
" <b>юзербот будет заморожен</b>. В следующем месяце <b>ты должен будешь"
" перейти на https://railway.app и перезапустить его</b>."
)
@loader.tds
class QuickstartMod(loader.Module):

View File

@ -655,6 +655,7 @@ def get_named_platform() -> str:
is_termux = "com.termux" in os.environ.get("PREFIX", "")
is_okteto = "OKTETO" in os.environ
is_railway = "RAILWAY" in os.environ
is_docker = "DOCKER" in os.environ
is_heroku = "DYNO" in os.environ
is_codespaces = "CODESPACES" in os.environ
@ -662,6 +663,9 @@ def get_named_platform() -> str:
if is_heroku:
return "♓️ Heroku"
if is_railway:
return "🚂 Railway"
if is_docker:
return "🐳 Docker"
@ -697,6 +701,9 @@ def get_platform_emoji() -> str:
if "com.termux" in os.environ.get("PREFIX", ""):
return BASE.format(5193051778001673828)
if "RAILWAY" in os.environ:
return BASE.format(5199607521593007466)
return BASE.format(5192765204898783881)