Tech
[Python] Discord Bot 만들기 - 2 (Python 개발환경 세팅, 초대한 Bot 활성화 하기)
꿀땡이
2022. 4. 1. 00:18
728x90
반응형
1. Python 개발환경 세팅
- IDE는 VisualStudio Code를 활용합니다.
- 왼쪽 메뉴에서 네모 박스 모양의 확장자 설치 탭 클릭 > Python 검색 > 아래 표시된 2개의 extensions 설치
2. Discord Package 설치
- 터미널 창에 'pip install discord' 입력
3. Bot을 활성화 시키기 위한 코드 작성
import discord, asyncio, os
from discord.ext import commands
game = discord.Game("Galbi Bot")
bot = commands.Bot(command_prefix='!', status=discord.Status.online, activity=game)
@bot.command(aliases=['안녕', '안녕하세요', 'hi', '갈비야'])
async def hello(ctx):
await ctx.send(f'{ctx.author.mention} 안녕하다옹')
bot.run('토큰 값 입력')
728x90
반응형