@Daniel1200

Возможно ли запустить исполняемый файл бота на discord.py на android?

Сейчас я нахожусь в отъезде и доступа к компьютеру нет, Но есть необходимость для запуска дискорд бота. Возможно ли запустить исполняемый файл бата на базе discord.py запустить на Андроиде, или это не возможно?

вот код если нужно:
import datetime
import random
import sqlite3
import discord
from discord.ext import commands
from datetime import datetime
import time
from datetime import date
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='D.', intents=intents)

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_member_join(member):
    con = sqlite3.connect('mydatabase.db')
 
    cursorObj = con.cursor()
 
    cursorObj.execute('create table if not exists now(id INTEGER, rawexp INTEGER, date DATE,  level INTEGER)')

    userdate = datetime.now()
    userid = member.author.id
    userrawexp = 0
    userlevel = 1
 
    cursorObj.execute("INSERT INTO now VALUES(?, ?, ?, ?);", (userid, userrawexp, userdate, userlevel))
 
    con.commit()

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if len(message.content) > 19:
        now_re = len(message.content)
        now_re = now_re // 20
        userid = message.author.id
        con = sqlite3.connect('mydatabase.db')
        cursorObj = con.cursor() 
        cursorObj.execute('create table if not exists now(id INTEGER, rawexp INTEGER, date DATE, level INTEGER)')
        cursorObj.execute(f"SELECT rawexp FROM now where id = ? ",(int(userid),))
        old_re = cursorObj.fetchone()
        old_re = old_re[0]
        now_re = now_re + int(old_re)
        cursorObj.execute('UPDATE now SET rawexp = ? where id = ?',(now_re,userid))
        cursorObj.execute(f"SELECT date FROM now where id = ? ",(int(userid),))
        userdate = cursorObj.fetchone()
        userdate = userdate[0]
        userdate = datetime.strptime(userdate, '%Y-%m-%d %H:%M:%S.%f')
        userdate = userdate.date()
        tn = datetime.now()
        tn = date(2022,12,12)
        delta = tn - userdate
        dos = (delta.days)
        dos = abs(dos)
        cursorObj.execute(f"SELECT level FROM now where id = ? ",(int(userid),))
        level = cursorObj.fetchone()
        level = level[0]
        level = int(level)
        wc = level
        befnl = 50
        btfnl = 1
        el = level
        print("wc:",wc,"level:",level,"dos:",dos,"tn:",tn,"befnl:",befnl,"btfnl:",btfnl,"now_re:",now_re)
        while wc != 0:
            print("wc:",wc,"level:",level,"dos:",dos,"tn:",tn,"befnl:",befnl,"btfnl:",btfnl,"now_re:",now_re)
            befnl = befnl * 2
            btfnl = btfnl * 1.5
            if dos >= btfnl:
                if now_re >= befnl:
                    el = el + 1
            wc = wc - 1
            
        cursorObj.execute('UPDATE now SET level = ? where id = ?',(el,userid))
        con.commit()

    await client.process_commands(message)
@client.command()
async def тестдатабазы(ctx):
        con = sqlite3.connect('mydatabase.db')
        cursorObj = con.cursor()
        a = ctx.author.id
        print(a)
        cursorObj.execute(f"SELECT * FROM now")
        d = cursorObj.fetchall()
        await ctx.send(f'{d}')

@client.command()
async def НУЧ(ctx):
    con = sqlite3.connect('mydatabase.db')
 
    cursorObj = con.cursor()

    cursorObj.execute('create table if not exists now(id INТЕGER, rawexp INTEGER, date DATE, level INTEGER)')

    a = ctx.author.id
    
    cursorObj.execute(f"SELECT * FROM now where id = ? ",(int(a),))#проверка, существует ли участник в БД
    if cursorObj.fetchone() != None:
        cursorObj.execute('DELETE from now where id = ? ',(int(a),))
        userdate = datetime.now()
        userid = ctx.author.id
        userrawexp = 0
        userlevel = 1
        cursorObj.execute("INSERT INTO now VALUES(?, ?, ?, ?);", (userid, userrawexp, userdate, userlevel))
    else:
        userdate = datetime.now()
        userid = ctx.author.id
        userrawexp = 0
        userexp = 0
        userlevel = 1
        cursorObj.execute("INSERT INTO now VALUES(?, ?, ?, ?);", (userid, userrawexp, userdate, userlevel))
    con.commit()

@client.command()
async def время(ctx):
    now = datetime.now()
    s = now.time()
    await ctx.send(f'{s}')


@client.command()
async def DaElBP1(ctx):
    a = datetime.now()
    b = datetime.now()
    first_date = a.date()
    second_date = b.date()
    delta = second_date - first_date
    print(delta)

@client.command()
async def примитивныйкалькулятор(ctx,arg1,arg2,arg3):
    a = arg1
    b = arg2
    c = arg3
    if (b) == "*" :
        a = int(a) * int(c)
    else:
        if (b) == "+":
            a = int(a) + int(c)
        else:
            if (b) == "-":
                a = int(a) + int(c)
            else:
                if (b) == "/":
                    a = int(a) / int(c)    
    await ctx.send(f'{int(a)}')

client.run('Token')
  • Вопрос задан
  • 117 просмотров
Решения вопроса 1
@Forraz
Ищи в плеймаркете интерпритатор, устанавливай модули и запускай, всё должно работать. Могу посоветовать Pydroid.
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
@Drno
если туда можно установить питон... то да
а не проще ВПС за 100р.мес арендовать?
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
26 апр. 2024, в 09:18
500 руб./в час
26 апр. 2024, в 06:46
1500 руб./в час
26 апр. 2024, в 05:31
1000 руб./за проект