๐ ์ฑ๋ ์
์ฅํ๊ธฐ

๋งค์ผ ์คํ 6์๋ง๋ค ๋น์ผ ์ฌ๋ผ์จ ๋๊ตญ๋ํ๊ต ํํ์ด์ง์ ์ผ๋ฐ/ํ์ฌ/์ฅํ ๊ณต์ง๋ฅผ ์๋ ค์ฃผ๋ dgu-notice-bot์ด 2022๋ 3์ 2์ผ ๋๊ตญ๋ํ๊ต ํํ์ด์ง ๊ฐํธ๊ณผ ๊ด๋ฆฌ์ ๊ฐ์ธ ์ฌ์ ์ผ๋ก ์ธํด ์๋ฆผ ์๋น์ค๋ฅผ ์ข ๋ฃํ๊ฒ ๋์ด, ๊ฐํธ๋ ํํ์ด์ง์ ๋ง๊ฒ ์ฝ๋๋ฅผ ์์ ํ๊ณ ์๋กญ๊ฒ ๋ง๋ ๋์ค์ฝ๋ ๊ณต์ง๋ด.
๊ธฐ์กด๊ณผ ๋์ผํ๊ฒ ์ฑ๋ ๋ฉ์์ง๋ฅผ ํตํด ๊ณต์ง๋ฅผ ์๋ ค์ฃผ๋ฉฐ, ์ฌ์ฉ์ ์ฑ๋๊ณผ ๋ช ๋ น์ด ๋ฑ์ด ์ถ๊ฐ๋์๋ค.
OS: Window 10
- Python 3.9.1
- requests
- discord.py
๊ธฐํ ์ฌ์ฉ๋ ํจํค์ง ์ ์ฒด๋ requirement.txt๋ฅผ ํตํด ํ์ธํ์ค ์ ์์ต๋๋ค.
- Clone this repository.
git clone https://github.com/c2lv/bampal2.git
- Change directory and activate virtualenv.
cd bampal2
pip3 install virtualenv
virtualenv "Enter Your Virtual Environment Name"
source "Enter Your Virtual Environment Name"/Scripts/activate
- Add Discord bot token in
BOT_TOKEN(Config Var).
export BOT_TOKEN="Enter Your Discord Bot Token"
- Install the requirements.
pip3 install -r requirements.txt
- Set channel ID in
const.py - Run
discord_bot.pyfile.
python3 discord_bot.py
[DiscordBot] ํ์ด์ฌ์ผ๋ก ๋์ค์ฝ๋ ๋ด ๋ง๋ค๊ธฐ -1~2
๋์ค์ฝ๋ ์ฑ๋ ์์ด๋ ์์๋ด๊ธฐ
์ฌ์ดํธ ์ ๋ณด ์ถ์ถํ๊ธฐ - beautifulsoup ์ฌ์ฉ๋ฒ (1~2)
๋์ค์ฝ๋ ๋ด ๊ฐ์ข - 1~5ํธ, ๋ฒ์ธํธ
Send a message to a Discord channel at a certain time once a week
๋ช ๋ น์ด ์๋ฌ์ฒ๋ฆฌ
Cog
ํค๋ก์ฟ ํ๊ฒฝ๋ณ์ ์ค์ ํ๊ณ ํ์ด์ฌ์์ ์ฌ์ฉํ๊ธฐ
ํค๋ก์ฟ ๋ฌด๋ฃ์๊ฐ 1000์๊ฐ์ผ๋ก ๋๋ฆฌ๊ธฐ
Heroku ๋ก๊ทธ๋ณด๊ธฐ
Heroku์ ๋ก๊ทธ์ธ ๋ ์ํ์์ Terminal์ ๋ค์๊ณผ ๊ฐ์ด ์ ๋ ฅ
heroku logs -a [์ฑ์ด๋ฆ]
์ต๊ทผ 150์ค์ ์ถ๋ ฅํ๊ณ ์ถ์ ๋๋ ๋ค์๊ณผ ๊ฐ์ด ์ ๋ ฅ (-n ์ต์ ์ด ์์ ๊ฒฝ์ฐ ์ต๊ทผ 100์ค์ ์ถ๋ ฅ)
heroku logs -n 150
๋์ค์ฝ๋ ์ ๋ฐ์ดํธ ๊ด๋ จ ๋ณํ ๊ด๋ จ ์ ๋ณด
- https://intrepidgeeks.com/tutorial/discord-py-v2-let-me-try-00
- https://intrepidgeeks.com/tutorial/as-1-modify-crawling-command-error
- https://discordpy.readthedocs.io/en/stable/intents.html
- API๊ฐ ๋ฐํํ ๊ฐ์ ์ด๋ป๊ฒ ํ์ธํ ์ ์๋์ง, ์ด๋ป๊ฒ ํด๊ฒฐํด์ผ ํ๋ ์ง ์ ๋ชจ๋ฅด๊ฒ ๋ค.
ํด๋น ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด ๋ด์ด ์๋ฌ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅํ๋๋ก on_command_error() ๋ด๋ถ์ ์กฐ๊ฑด๋ฌธ์ ํ๋ ์ถ๊ฐํ๋ค.
discord.errors.HTTPException: 429 Too Many Requests (error code: 0):
You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently.
Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.