13
13
import re
14
14
from korcen import korcen
15
15
16
+
16
17
start_times = time .time ()
17
18
why = ['으에?' , '몰?루' , '왜요용' , '잉' , '...?' , '몰라여' , '으에.. 그게 뭐징?' , '네?' ]
18
19
20
+
19
21
class Bot (commands .Bot ):
20
22
def __init__ (self , intents : discord .Intents , ** kwargs ):
21
23
super ().__init__ (command_prefix = ["/" , "!" , "시이 " ], intents = intents , case_insensitive = True )
22
24
23
25
async def on_ready (self ):
24
26
print (f"Logged in as { self .user } " )
25
27
await self .change_presence (status = discord .Status .online ,
26
- activity = discord .Activity (type = discord .ActivityType .listening , name = "류현준 난간" ))
28
+ activity = discord .Activity (type = discord .ActivityType .listening , name = "류현준 난간 " ))
27
29
await self .tree .sync ()
28
- kb = DiscordpyKoreanbots (self ,
29
- run_task = True )
30
+ kb = DiscordpyKoreanbots (self ,run_task = True )
30
31
ss = self .guilds
31
32
print (ss )
32
33
simulate_stock_market .start ()
@@ -40,6 +41,25 @@ def __init__(self):
40
41
self .detect_swearing = False
41
42
42
43
44
+
45
+ class PollView (discord .ui .View ):
46
+ def __init__ (self , poll_options ):
47
+ super ().__init__ ()
48
+ for option in poll_options :
49
+ button = discord .ui .Button (style = discord .ButtonStyle .gray , label = option )
50
+ button .callback = self ._on_button
51
+ self .add_item (button )
52
+ self .poll_message = None
53
+
54
+ async def _on_button (self , interaction ):
55
+ for item in self .children :
56
+ if isinstance (item , discord .ui .Button ) and item .label == interaction .component .label :
57
+ await interaction .response .send_message (f"{ interaction .user } 님이 '{ item .label } ' 옵션을 선택했습니다." , ephemeral = True )
58
+ await self .poll_message .delete ()
59
+ self .stop ()
60
+ break
61
+
62
+
43
63
json_file_path = 'bot_info.json'
44
64
attendance_file = 'attendance.json'
45
65
intents = discord .Intents .all ()
@@ -60,7 +80,7 @@ def __init__(self):
60
80
count_FILE = 'count.json'
61
81
start_time = datetime .now ()
62
82
settings = BotSettings ()
63
-
83
+ intents . message_content = True
64
84
65
85
66
86
async def load_datas ():
@@ -513,12 +533,6 @@ async def view_stocks(interaction: discord.Interaction):
513
533
await interaction .send ("보유한 주식이 없습니다." )
514
534
515
535
516
- @bot .hybrid_command (name = "설날" , description = "새해복 많이 받으세요!" )
517
- async def newyear (interaction : discord .Interaction ):
518
- await interaction .send (f"{ interaction .author .mention } ! 새해복 많이 받으세요!" )
519
- await asyncio .sleep (3 )
520
- await interaction .send ('그니까 용돈 주세요' )
521
-
522
536
523
537
@bot .hybrid_command (name = '업다운시작' , description = "업다운 개임!(베타)" )
524
538
async def start_game (interaction : discord .Interaction ):
@@ -749,10 +763,10 @@ async def hert(interaction: discord.Interaction):
749
763
750
764
@bot .hybrid_command (name = '공지사항' , description = "시이봇의 공지를 볼 수 있어요!" )
751
765
async def announcement (interaction : discord .Interaction ):
752
- embed = discord .Embed (title = "시이봇 공지 사항" , description = "2024.02.11일 공지" , color = 0xFFB2F5 )
766
+ embed = discord .Embed (title = "시이봇 공지 사항" , description = "2024.02.15일 공지" , color = 0xFFB2F5 )
753
767
embed .add_field (name = "시이봇 개발 안내" , value = "시이봇 점검(개발) 기간은 매일 약 오후2시 부터 오후 6시 입니다. 이때는 시이봇이 멈출수도 있으니 양해 부탁드립니다." ,
754
768
inline = False )
755
- embed .add_field (name = "시이봇 공식 사이트 개발 공지 " , value = "이번에 shii.me 도매인을 얻었습니다. 그래서 현재 사이트 개발중 이니 많은관심 부탁드립니다! " ,
769
+ embed .add_field (name = "/번역 관련 공지 (중요) " , value = "현제, /번역 커멘드는 네이버의 파파고 openapi 를 사용하여 개발하였습니다. 그러나 파파고 번역 api가 2월 29일자로 서비스가 종료되어, 2월 29일자 이후로는 /번역이 사용이 불가하여, 2월 28일자로 /번역 서비스를 종료함을 알려드립니다. 죄송합니다. " ,
756
770
inline = False )
757
771
await interaction .send (embed = embed )
758
772
@@ -874,15 +888,15 @@ async def help(interaction: discord.Interaction):
874
888
embed .set_thumbnail (url = 'https://cdn.litt.ly/images/d7qircjSN5w6FNgD5Oh57blUjrfbBmCj?s=1200x1200&m=outside&f=webp' )
875
889
embed .add_field (name = "**일반**" , value = "핑, 하트, 번역, 패치노트, 계산, 인원통계, 타이머, 프로필, 급식, 메모쓰기, 메모불러오기, 공지사항, 패치노트, 카운트" , inline = False )
876
890
embed .add_field (name = "**검색**" , value = "네이버검색, 유튜브검색, 블로그검색, 애니검색" , inline = False )
877
- embed .add_field (name = "**재미**" , value = "고양이 ,알려주기, 급식, 호감도확인, 호감도도움말, 가위바위보, 광질, 주사위, 업다운시작, 업다운, 설날, 이모지 " , inline = False )
891
+ embed .add_field (name = "**재미**" , value = "고양이 ,알려주기, 급식, 호감도확인, 호감도도움말, 가위바위보, 광질, 주사위, 업다운시작, 업다운, 이모지, 골라 " , inline = False )
878
892
embed .add_field (name = "**주식**" , value = "주식매수, 주식매도, 가격보기, 자본" , inline = False )
879
893
embed .add_field (name = "**보이스**" , value = "음성채널입장, 음성채널퇴장" , inline = False )
880
894
embed .add_field (name = "**관리**" , value = "내정보, 프로필, 클리어, 임베드생성, 욕설필터링" , inline = False )
881
895
embed .add_field (name = "" , value = "" , inline = False )
882
896
embed .add_field (name = "시이가 궁금하다면" , value = "[시이 개발 서버](https://discord.gg/SNqd5JqCzU)" )
883
- embed .add_field (name = "시이를 서버에 초대하고 싶다면" , value = "[시이 초대하기](https://discord.com/oauth2/authorize?client_id=&scope=bot&permissions=0)" )
897
+ embed .add_field (name = "시이를 서버에 초대하고 싶다면" , value = "[시이 초대하기](https://discord.com/oauth2/authorize?client_id=1197084521644961913 &scope=bot&permissions=0)" )
884
898
embed .add_field (name = "개발자를 응원할려면" , value = "[시이 하트 눌러주기](https://koreanbots.dev/bots//vote)" )
885
- embed .set_footer (text = "버전: v2.16.8 " )
899
+ embed .set_footer (text = "버전: v2.16.9 " )
886
900
await interaction .send (embed = embed )
887
901
888
902
@@ -894,6 +908,7 @@ async def hhlep(interaction: discord.Interaction):
894
908
embed .add_field (name = "호감도 상승법" , value = "/시이야, /알려주기 커멘드에서 각각 한번 실행 시킬떄 마다 1,2 씩 상승합니다." , inline = False )
895
909
await interaction .send (embed = embed )
896
910
911
+
897
912
@bot .hybrid_command (name = '욕설필터링' , description = "욕설필터링기능을 끄고 킵니다.(관리자 권한 필요)" )
898
913
async def toggle_swearing_detection (interaction : discord .Interaction ):
899
914
if interaction .author .guild_permissions .manage_messages :
@@ -904,11 +919,18 @@ async def toggle_swearing_detection(interaction: discord.Interaction):
904
919
await interaction .send ("관리자만 욕설 감지 설정을 변경할 수 있습니다." )
905
920
906
921
922
+ @bot .hybrid_command (name = "골라" , description = "시이가 골라줍니다" )
923
+ async def ox (interaction : discord .Interaction , cho : str ):
924
+ words = cho .split ()
925
+ selected_word = random .choice (words ) # 단어 리스트에서 랜덤으로 선택
926
+ await interaction .send (f"저는 { selected_word } 요!" )
927
+
928
+
907
929
908
930
@bot .hybrid_command (name = "패치노트" , description = "시이봇 패치노트 보기" )
909
931
async def pt (interaction : discord .Interaction ):
910
- embed = discord .Embed (title = "v2.16.8 패치노트" , color = 0xFFB2F5 )
911
- embed .add_field (name = "신규기능" , value = "오류 리포트 시스템 추가" , inline = False )
932
+ embed = discord .Embed (title = "v2.16.9 패치노트" , color = 0xFFB2F5 )
933
+ embed .add_field (name = "신규기능" , value = "오류 리포트 시스템 삭제 및 /설날 삭제, 신규 커멘드 /골라 추가" , inline = False )
912
934
embed .add_field (name = "버그 수정" , value = "없음" , inline = False )
913
935
await interaction .send (embed = embed )
914
936
@@ -1001,8 +1023,13 @@ async def on_message(message):
1001
1023
happiness_manager .increment_user_happiness (server_id , user_id , amount = 1 )
1002
1024
happiness_manager .save_to_file ()
1003
1025
info = bot_info .get (message1 )
1026
+ total_member_count = 0
1027
+ for guild in bot .guilds :
1028
+ if guild .name != "한국 디스코드 리스트" :
1029
+ total_member_count += guild .member_count
1004
1030
word = {
1005
1031
f'{ message .author .display_name } ' : f"저가 { message .author .display_name } 님을 모를리 없죠!" ,
1032
+ '정보' : f'지금 시이는 `{ len (bot .guilds )} ` 개의 서버에서 `{ total_member_count } 명` 분들을 위해 일하고 있어요!' ,
1006
1033
'hello' : '안녕하세욧!' ,
1007
1034
'안녕' : '안녕하세요. 시이입니다!' ,
1008
1035
'누구야' : '안녕하세요. shii입니다!' ,
@@ -1012,7 +1039,7 @@ async def on_message(message):
1012
1039
'게임' : '게임하면 또 마크랑 원신을 빼놀수 없죠!' ,
1013
1040
'ㅋㅋㅋ' : 'ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ' ,
1014
1041
'이스터에그' : '아직 방장님이 말 하지 말라고 했는데....아직 비밀이예욧!' ,
1015
- '패치버전' : '패치버전 v2.16.8 ' ,
1042
+ '패치버전' : '패치버전 v2.16.9 ' ,
1016
1043
'과자' : '음...과자하니까 과자 먹고 싶당' ,
1017
1044
'뭐해?' : '음.....일하죠 일! 크흠' ,
1018
1045
'음성채널' : '음성채널는 현재 방장이 돈이 없어서 불가능 합니다ㅠㅠ' ,
@@ -1081,26 +1108,4 @@ def get_time():
1081
1108
return datetime .today ().strftime ("%H시 %M분 %S초" )
1082
1109
1083
1110
1084
- @bot .event
1085
- async def on_command_error (ctx , error ):
1086
- if isinstance (error , commands .CommandNotFound ):
1087
- return
1088
- embed = discord .Embed (title = "오류가 발생하였습니다. 죄송합니다." , description = "오류 로그를 개발자에게 전송 하실려면 이모지를 눌러주세요." , color = 0xFF2424 )
1089
- message5 = await ctx .send (embed = embed )
1090
- await message5 .add_reaction ("📩" )
1091
- def check (reaction , user ):
1092
- return str (reaction .emoji ) == "📩"
1093
- try :
1094
- user , reaction = await bot .wait_for ('reaction_add' , timeout = 30.0 , check = check )
1095
- except asyncio .TimeoutError :
1096
- await ctx .send ("오류로그를 보내지 않습니다." )
1097
- else :
1098
- if isinstance (error , commands .CommandError ):
1099
- target_user_id =
1100
- target_user = await bot .fetch_user (target_user_id )
1101
- await target_user .send (f'오류 발생: `{ ctx .command } ` - { error } - { format (get_time ())} ' )
1102
- pass
1103
-
1104
-
1105
-
1106
1111
bot .run ()
0 commit comments