Skip to content

Commit

Permalink
Merge pull request #14 from JAY-Chan9yu/feature/limit-emoji-buf-fix
Browse files Browse the repository at this point in the history
fix: `LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI` default ๊ฐ’ ๋ณ€๊ฒฝ
  • Loading branch information
JAY-Chan9yu authored Aug 12, 2023
2 parents b3c79cd + 0165360 commit 895b10f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .env_sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BOT_NAME="heymojiBOT"
ERROR_CHANNEL=""

SPECIAL_EMOJI="trophy" # ๐Ÿ†
LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI=5
LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI=1000
ALLOWED_REACTION_LIST=["pray", "heart", "eye_shaking", "+1", "๊ธฐ๋„", "๊ธฐ์จ", "kkkk", "trophy", "ํŠธ๋กœํ”ผ"]
ALLOWED_EMOJI_TYPES='[
{"emoji": "โค๏ธ", "emoji_names": ["heart"]},
Expand Down
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,24 @@ DDD์— ๋Œ€ํ•œ ์Šคํ„ฐ๋””๋ฅผ ์œ„ํ•ด ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์œผ๋ฉฐ https://github.com/E
DB๋Š” `MySQL`์„ ์‚ฌ์šฉํ•˜๋ฉฐ ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด `aiomysql`๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.<br/>
๋‹ค๋ฅธ DB ์‚ฌ์šฉํ•˜๋ ค๋ฉด `config` ์„ค์ •์ด ์กฐ๊ธˆ ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

| ์ด๋ฆ„ | ์„ค๋ช… |
|-----------------------------------|-------------------------------------|
| ENV | ๋ฐฐํฌํ™˜๊ฒฝ ์ •์˜ |
| ALLOW_ORIGINS | CORS๋ฅผ ํ—ˆ์šฉํ•  ORIGIN ๋ฆฌ์ŠคํŠธ |
| DB_HOST | DB ํ˜ธ์ŠคํŠธ |
| DB_PORT | DB ํฌํŠธ |
| DATABASE | DB ์ด๋ฆ„ |
| DB_USERNAME | DB ์ ‘์† ์œ ์ €๋„ค์ž„ |
| DB_PASSWORD | DB ํŒจ์Šค์›Œ๋“œ |
| SLACK_TOKEN | ์Šฌ๋ž™ ํ† ํฐ |
| BOT_NAME | ์Šฌ๋ž™๋ด‡ ์ด๋ฆ„ |
| ERROR_CHANNEL | ์Šฌ๋ž™ ์—๋Ÿฌ ๋ฆฌํฌํŒ… ์ฑ„๋„ |
| SPECIAL_EMOJI | ํŠน๋ณ„ํ•œ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง„ ์ด๋ชจ์ง€ |
| LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI | ํ•˜๋ฃจ์— ๋‚จ๊ธธ์ˆ˜ ์žˆ๋Š” SPECIAL_EMOJI ์ตœ๋Œ€ ๊ฐœ์ˆ˜ |
| ALLOWED_REACTION_LIST | ์›นํ›… ๋ฆฌ์•ก์…˜์œผ๋กœ ํ—ˆ์šฉ๋œ ์ด๋ชจ์ง€(reaction)๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. |
| ALLOWED_EMOJI_TYPES | ํ•ธ๋“ค๋งํ•  ์ด๋ชจ์ง€๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. |
| RANK_URL | ๋žญํ‚น ์›นํŽ˜์ด์ง€ URK |
| DEFAULT_AVATAR_URL | ๊ธฐ๋ณธ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ URL |
| ์ด๋ฆ„ | ์„ค๋ช… |
|-----------------------------------|---------------------------------------|
| ENV | ๋ฐฐํฌํ™˜๊ฒฝ ์ •์˜ |
| ALLOW_ORIGINS | CORS๋ฅผ ํ—ˆ์šฉํ•  ORIGIN ๋ฆฌ์ŠคํŠธ |
| DB_HOST | DB ํ˜ธ์ŠคํŠธ |
| DB_PORT | DB ํฌํŠธ |
| DATABASE | DB ์ด๋ฆ„ |
| DB_USERNAME | DB ์ ‘์† ์œ ์ €๋„ค์ž„ |
| DB_PASSWORD | DB ํŒจ์Šค์›Œ๋“œ |
| SLACK_TOKEN | ์Šฌ๋ž™ ํ† ํฐ |
| BOT_NAME | ์Šฌ๋ž™๋ด‡ ์ด๋ฆ„ |
| ERROR_CHANNEL | ์Šฌ๋ž™ ์—๋Ÿฌ ๋ฆฌํฌํŒ… ์ฑ„๋„ |
| SPECIAL_EMOJI | ํŠน๋ณ„ํ•œ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง„ ์ด๋ชจ์ง€ |
| LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI | ๋งค์›” ๋‹ค๋ฅธ ๋ฉค๋ฒ„์—๊ฒŒ ์ค„ ์ˆ˜ ์žˆ๋Š” SPECIAL_EMOJI ์ œํ•œ ๊ฐœ์ˆ˜ |
| ALLOWED_REACTION_LIST | ์›นํ›… ๋ฆฌ์•ก์…˜์œผ๋กœ ํ—ˆ์šฉ๋œ ์ด๋ชจ์ง€(reaction)๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. |
| ALLOWED_EMOJI_TYPES | ํ•ธ๋“ค๋งํ•  ์ด๋ชจ์ง€๋“ค์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. |
| RANK_URL | ๋žญํ‚น ์›นํŽ˜์ด์ง€ URK |
| DEFAULT_AVATAR_URL | ๊ธฐ๋ณธ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ URL |

<br/>

Expand Down Expand Up @@ -172,6 +172,7 @@ uvicorn app.main:app --port 8080
๐Ÿ™‰ ์œ ์ € ๋ณด์ด๊ธฐ
@EmojiBot --show_user --slack_id=์Šฌ๋ž™ID
```

### ๐ŸŽ– show_best_member ์˜ˆ์‹œ

<img width="499" alt="show_best_member ์˜ˆ์‹œ" src="https://user-images.githubusercontent.com/24591259/222969485-290c6d9d-841c-4a01-bd77-12af62db63da.png">
Expand Down Expand Up @@ -199,6 +200,7 @@ if [ "$checker" == "0" ]; then
cd $SCRIPT_PATH && `uvicorn main:app --port 8080 &`
fi
```

<br/>

# ๐Ÿค– Slack Bot ์„ค์ •
Expand Down
5 changes: 5 additions & 0 deletions app/domains/reactions/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ async def _decrease_reaction_count(cls, reaction: Reaction):

@classmethod
async def _can_increase_special_emoji(cls, reaction: Reaction) -> bool:
"""
todo: ๋ฆฌํŒฉํ† ๋ง ํ•˜๋ฉด์„œ ์ผ๋ณ„ ์นด์šดํŠธ ๋กœ์ง์„ ์ œ๊ฑฐ ํ–ˆ์Œ. ํ˜„์žฌ ๋กœ์ง์—์„œ `LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI`๋Š”
๋งค์›” ์ด๋ชจ์ง€๋ฅผ ์ค„ ์ˆ˜ ์žˆ๋Š” ์นด์šดํŠธ ์ œํ•œ์ด๋ผ๊ณ  ๋ณด๋ฉด๋จ.
ํ˜„์žฌ๋Š” ๊ตณ์ด ๋งค์ผ ์ค„ ์ˆ˜ ์žˆ๋Š” ์ด๋ชจ์ง€ ์ œํ•œ์ด ์˜๋ฏธ์—†์„ ๊ฒƒ ๊ฐ™์•„์„œ ์œ ์ง€ํ•˜๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ์ •๋ฆฌ
"""
count = await cls._repository().count_special_emoji_by_date_and_from_user(
from_user_id=reaction.from_user_id,
year=reaction.year,
Expand Down
2 changes: 1 addition & 1 deletion conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BaseConfig(BaseSettings):
BOT_NAME: str = Field(env="BOT_NAME", default="heymojiBOT")

SPECIAL_EMOJI: Optional[str] = Field(env="SPECIAL_EMOJI", default="trophy")
LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI: int = Field(env="LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI", default=5)
LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI: int = Field(env="LIMIT_GIVE_COUNT_OF_SPECIAL_EMOJI", default=1000)
ALLOWED_REACTION_LIST: list = Field(
env="ALLOWED_REACTION_LIST",
default=["pray", "heart", "eye_shaking", "+1", "๊ธฐ๋„", "๊ธฐ์จ", "kkkk", "trophy", "ํŠธ๋กœํ”ผ"]
Expand Down

0 comments on commit 895b10f

Please sign in to comment.