N
N
Nyxoy2021-12-07 18:37:23
Python
Nyxoy, 2021-12-07 18:37:23

How to make a discord bot open a file?

That is, I need to write .open (in discord) and the bot opens the file on my PC
discord.py library Python
version 3.6
OS: Windows 10 64x

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Q
QPDEH, 2021-12-07
@Nyxoy

Something like this, I have not looked at this library before

import os
from discord import *

client = Client()

@client.event
async def on_message(message):
    if message.content.startswith('.open'):
        os.system("полный_путь_к_твоему_файлу")

client.run("твой_токен")

A
alexbprofit, 2021-12-07
@alexbprofit

no way

J
JiMoon, 2021-12-10
@Jimoon

if SPECIFICALLY on your PC, then either os or socket will help (to connect to the computer, but most likely it will not work to change something)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question