Created
August 19, 2025 06:10
-
-
Save castrix/4f4205a3966a113352b1e42dbcf5754a to your computer and use it in GitHub Desktop.
bot.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import discord | |
TOKEN = "YOUR_DISCORD_BOT_TOKEN" # replace with your bot token | |
CHANNEL_ID = 123456789012345678 # replace with your channel ID | |
COMMAND = "!screenshot" # type this in Discord to trigger | |
intents = discord.Intents.default() | |
intents.message_content = True # needed to read messages | |
client = discord.Client(intents=intents) | |
@client.event | |
async def on_ready(): | |
print(f"✅ Logged in as {client.user}") | |
@client.event | |
async def on_message(message): | |
if message.author == client.user: | |
return | |
if message.content.strip().lower() == COMMAND: | |
screenshot_path = "/sdcard/screen.png" | |
os.system(f"screencap -p {screenshot_path}") | |
await message.channel.send(file=discord.File(screenshot_path)) | |
client.run(TOKEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment