우아한테크코스 프리코스 디스코드 채널 관리용 디스코드 봇 어플리케이션입니다.
- 채널 관리 권한 제한
- 유저가 특정 카테고리 안에서 채널 생성시 채널에 대한 수정 및 삭제 권한을 해당 채널 생성 유저에게만 부여합니다.
- 봇을 실행시 특정 카테고리 안에있는 기존 채널에 대한 수정 및 삭제 권한을 해당 채널 생성 유저에게만 부여합니다.
Discord Developer Portal에 접속하여 디스코드 봇을 생성합니다.
![image](https://private-user-images.githubusercontent.com/99083803/278410188-cebba5ec-d188-4dd6-a7b8-fd86562b607d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg0MTAxODgtY2ViYmE1ZWMtZDE4OC00ZGQ2LWE3YjgtZmQ4NjU2MmI2MDdkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM2N2NjZTA3OTdiMDUzMWM5MTExY2MzYThmZjZlMzdkMGI5NmM1YWZhOTY5OGVmZTE2MmExY2Y0ZGEwMzM0NzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2RBtkc6vd3EwmOPnwARGh3rjrTR9fOE7MIYZilA0w3Y)
생성할 봇의 이름을 작성합니다.
![image](https://private-user-images.githubusercontent.com/99083803/278412991-9e8ee0c0-8a65-43e9-b4cd-94f11f26b87f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg0MTI5OTEtOWU4ZWUwYzAtOGE2NS00M2U5LWI0Y2QtOTRmMTFmMjZiODdmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI0OTk3NzhkNTNlNzk2OTdhOTRiMDAwOWRiZDNkMDczZDVlNTExMzBjNGViY2IzZDY4NGNhZGMwMzcwYjM5MmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LbLNqYioUOgcDaNxv5Z8ZDBmu8QDk3KTHBiRsTV-Ja8)
OAuth2
항목에 URL Generator
에서 Scopes
의 Bot
을 체크한 후 Bot Permissions
에서 Administrator
를 체크 한 후 생성된 url에 접속합니다.
![image](https://private-user-images.githubusercontent.com/99083803/278812263-7a513c30-60f6-492d-ac5f-123a7dc7f023.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg4MTIyNjMtN2E1MTNjMzAtNjBmNi00OTJkLWFjNWYtMTIzYTdkYzdmMDIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM2ZGQ0NDA1YjA5MjliMTgwOTQ4ZjllMzIwOTM2ZTFlMmFjMWJjMTlkMGEwOWYyNmQyODAyYWJkNjkwNzRiMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.vCiZV7Kbt77u6H20X5eCnX5ljrg_2GQr6F6PQXi2OWk)
접속한 페이지에서 채널 관리 봇을 입장시킬 채널을 선택합니다.
![image](https://private-user-images.githubusercontent.com/99083803/278426864-1dd41009-42c9-4712-b2c2-c25833ed2561.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg0MjY4NjQtMWRkNDEwMDktNDJjOS00NzEyLWIyYzItYzI1ODMzZWQyNTYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFlZTYwM2E1NTgyODk5ZWRkMDdlNmYyOTU5ZTFlOGI1OTM3Zjk0YWI5NDJmNDQ5YTdiMTIxMWE4OTI2N2I5MGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9teuCuRyTHEtQ3e_HUY8wLXtDEtd6rGhbN8x-74M6jI)
프로젝트를 클론합니다.
git clone https://github.com/discord/discord-example-app.git](https://github.com/woowacourse-bot/discord-bot.git
cd discord-bot
패키지를 설치합니다.
npm install
디스코드의 사용자 설정에서 개발자 모드를 작동시킵니다.
![image](https://private-user-images.githubusercontent.com/99083803/278934545-1c1d0bf6-e40f-4da9-a167-c3423228f9ef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg5MzQ1NDUtMWMxZDBiZjYtZTQwZi00ZGE5LWExNjctYzM0MjMyMjhmOWVmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUwMjZmNWE1NDhjYjJiMmEzYTU2ODY2MWY4YzM5ZTYwNmFmM2E3MjY1ODcwN2Y2ZjY1ODFiYTU5NzYzNjA1NjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YvT1cEc4raflMmsIIjubuP8Gz6hNjU4vR87TsC6hj_Q)
적용시킬 서버의 서버 ID를 복사한 후 환경변수의 SERVER_ID
에 적용시킵니다.
![image](https://private-user-images.githubusercontent.com/99083803/278934896-804f357d-f9ad-49a2-87a3-24581869fd45.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg5MzQ4OTYtODA0ZjM1N2QtZjlhZC00OWEyLTg3YTMtMjQ1ODE4NjlmZDQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE5NDQ1NzcyNGZlYmFhNWQ3NTg3ZWUwMmI5MGFjN2ZhMmJhYjc4MGFlNjI3MzU4ZDIxNTNlYWZiNzkyZTE1MGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.whR2HPk-oak9YIk6pyZr9BFdoJazMQKKVR9DcNSIPQw)
디스코드 봇 페이지의 OAuth2의 General에서 클라이언트 ID를 복사한 후 환경변수의 CLIENT_ID
에 적용시킵니다.
![image](https://private-user-images.githubusercontent.com/99083803/278935772-8d1afce5-45fe-4d18-ae04-1a20c6c07e08.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg5MzU3NzItOGQxYWZjZTUtNDVmZS00ZDE4LWFlMDQtMWEyMGM2YzA3ZTA4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE0MjE5ZjkzNjgwZGY0MGNkNGQxNWU0YTZmZWQyYWI5MzY1OGY5MmI5OGI3OWM0YjJhOWI3Nzg0MGI2NWE3ZDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.k9CDCBQ3nLMRbLk4u_AsORx4LpYV2ehwl4gXyldVtTM)
디스코드 봇 페이지의 Bot에서 Reset token을 눌러 토큰을 생성 후 환경변수의 DISCORD_TOKEN
에 적용시킵니다.
![image](https://private-user-images.githubusercontent.com/99083803/278413767-02ec46a4-465e-47c1-85b6-5e6667ad5ef4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg0MTM3NjctMDJlYzQ2YTQtNDY1ZS00N2MxLTg1YjYtNWU2NjY3YWQ1ZWY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRmZGVkYzViOWM0MDljMWU0OWMxZjA1ZDJiM2Y5OTNmNmQ0ZjY4OTFjZWNiNjMzNTMxNWFjYjBkN2MxODQ2ZmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XNUGbR7XvK8Ok8e38k1SrY_Is2kXpv3FqTZXDiYeLkA)
프로젝트를 실행합니다.
npm start
정상 실행시 접속 커맨드가 콘솔에 나타납니다.
Started refreshing application (/) commands.
Successfully reloaded application (/) commands.
Logged in as 채널 관리 봇#0022!
디스코드 봇이 작동 중인 상태에서는 스스로 만들기 채널에 대한 삭제 및 수정 권한은 어드민과 채널 생성자에게만 권한이 부여됩니다.
ex) 본인 생성 채널
![image](https://private-user-images.githubusercontent.com/99083803/278936449-df9b19bc-eef3-4a8a-ba50-a8e234c38ad5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg5MzY0NDktZGY5YjE5YmMtZWVmMy00YThhLWJhNTAtYThlMjM0YzM4YWQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA5ZGFiM2Q0OTI3ODk4ODIwMDEwNTUwOWVmOTViZTM0YTQ4ZGU0MTAwNWQ1M2RmYmI0ODk5NWZlNmJmNDljMzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VoI2RTcqoLluXa0zzVp4cX1b3P_6hZJ0lBE51z5XNqc)
ex) 타인 생성 채널
![image](https://private-user-images.githubusercontent.com/99083803/278936389-a8489cc4-f8a7-428d-99e9-f3a9ec42da87.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMTA4MzUsIm5iZiI6MTcyNDAxMDUzNSwicGF0aCI6Ii85OTA4MzgwMy8yNzg5MzYzODktYTg0ODljYzQtZjhhNy00MjhkLTk5ZTktZjNhOWVjNDJkYTg3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE5NDg1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxNmU2MmMzNzFiYmY5Zjk1ZTUyZjJlMGY2MjMwZjU1ZWY0MTNkNmY3MTYyMGQzZmFmMjA5MTM5MjA2YTg3YjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Dhn5DDJLUWR9T2x-BjzMgdF-8xT45DLVF3BRmTDNKUc)