전체 글

Node.js로 뭔가를 만들고 실행시킬 때, 코드를 수정하고 다시 실행해줘야 하는 번거로움이 있습니다. 하지만 supervisor을 사용하면 코드의 수정사항을 감지하여 자동으로 재시작해줍니다. 설치 방법 npm install supervisor -g 꼭 -g 옵션으로 설치하셔야됩니다. 사용 방법 supervisor (file).js 오류가 나서 종료되거나 코드가 수정되었을 때 자동으로 재시작해줍니다.
0. pip를 사용해서 pymongo를 설치한다 pip install pymongo 1. 모듈 import from pymongo import MongoClient 2. pymongo를 통한 mongo client 연결하기 client = MongoClient("mongodb://127.0.0.1:27017/") 제대로 연결됐는지 확인하기 위해서 db 목록 출력해봅니다 print(client.list_database_names()) 출력 결과는 아래와 같습니다 ['admin', 'local', 'config' ···] 3. find() client["db이름"]["collection이름"].find() collection 안의 모든 데이터를 불러옵니다. 이때 pymongo.cursor.Cursor 객체가..
소스코드 유튜브 영상 넣기 제출 제출
2021.05.15 - [프로젝트/[파이썬] 디스코드 봇 만들기] - [디스코드 봇 만들기] part 1 - 봇 생성 오늘은 지난번에 만든 봇이 작동하도록 만들 겁니다. 오늘의 목표는 사용자가 "@안녕"이라고 메시지를 보내면 봇이 대답하는 것입니다. 전체 코드 from discord.ext import commands bot = commands.Bot(command_prefix="") # 봇이 준비되었을때 @bot.event async def on_ready(): await bot.change_presence(status=discord.Status.online, activity=discord.Game("@안녕")) # 봇의 상태를 설정합니다 # 메시지를 받았을 때 @bot.event async def o..
import ctypes ctypes.windll.user32.SystemParametersInfoW(20, 0, "사진 경로" , 3) 경로는 전체경로입니다. Windows에서 작동합니다.
사용 언어(part 2부터 사용) : Python (3.x.x) 디스코드 봇을 만드는 방법입니다. 먼저 아래 링크에 접속합니다. https://discord.com/developers/applications Discord Developer Portal — API Docs for Bots and Developers Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with. discord.com 접속 시 위와 같은 화면이 보이는데, 여기서 오른쪽 위의 New Application을 클릭합니다. 봇의 이름을 정해줍니다. test같은 흔한 이름은 안됩니다..
See the Pen eng-kor by Sol-Studio (@sol-studio) on CodePen.
See the Pen d-day by Sol-Studio (@sol-studio) on CodePen.
See the Pen hash by Sol-Studio (@sol-studio) on CodePen.
import asyncio import websockets async def accept(websocket, path): while True: try: data = await websocket.recv() print("receive : " + data) except KeyboardInterrupt: # ctrl + c로 강제종료 exit() except (websockets.exceptions.ConnectionClosedOK, websockets.exceptions.ConnectionClosedError): # 소켓이 강제로 닫히거나 사용자가 그냥 떠난 경우 break start_server = websockets.serve(accept, "0.0.0.0", 2000) # host, port async..
Sol Studio 공식 블로그
sol-studio