Skip to content

Instantly share code, notes, and snippets.

@vestige
Last active July 26, 2020 07:35
Show Gist options
  • Save vestige/d2cf5b2f4d954f8092183fb6bb461ecb to your computer and use it in GitHub Desktop.
Save vestige/d2cf5b2f4d954f8092183fb6bb461ecb to your computer and use it in GitHub Desktop.
torpc_remote.py
import picamera
import discord
import asyncio
client = discord.Client()
x = 0
#ここをご自身の環境に書き換えてください。
chid = ここにチャンネルIDを貼り付け
token = "ここにBOTトークンを貼り付け"
#これ以下は書き換えないでください。
@client.event
async def on_ready():
CHANNEL_ID = chid
channel = client.get_channel(CHANNEL_ID)
await channel.send('参加したよ!')
@client.event
async def on_message(message):
global x
if message.content == '写真':
with picamera.PiCamera() as camera:
camera.resolution = (1920,1080)
camera.capture(str(x)+".jpg")
CHANNEL_ID = chid
channel = client.get_channel(CHANNEL_ID)
await channel.send(file=discord.File(str(x)+'.jpg'))
x = x + 1
client.run(token)
@kotatuneco
Copy link

import picamera
import discord
import asyncio

client = discord.Client()
x = 0

#ここをご自身の環境に書き換えてください。
chid = ここにチャンネルIDを貼り付け
token = "ここにBOTトークンを貼り付け"
#これ以下は書き換えないでください。

@client.event
async def on_ready():
CHANNEL_ID = chid
channel = client.get_channel(CHANNEL_ID)
await channel.send('参加したよ!')

@client.event
async def on_message(message):
global x
if message.content == '写真':
with picamera.PiCamera() as camera:
camera.resolution = (1920,1080)
camera.capture(str(x)+".jpg")
CHANNEL_ID = chid
channel = client.get_channel(CHANNEL_ID)
await channel.send(file=discord.File(str(x)+'.jpg'))
x = x + 1

client.run(token)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment