Skip to content

Commit 0f2c78b

Browse files
authored
Update shii-bot.py
v2.16.9
1 parent 9c5f954 commit 0f2c78b

File tree

1 file changed

+45
-40
lines changed

1 file changed

+45
-40
lines changed

shii-bot.py

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,21 @@
1313
import re
1414
from korcen import korcen
1515

16+
1617
start_times = time.time()
1718
why = ['으에?', '몰?루', '왜요용', '잉', '...?', '몰라여', '으에.. 그게 뭐징?', '네?']
1819

20+
1921
class Bot(commands.Bot):
2022
def __init__(self, intents: discord.Intents, **kwargs):
2123
super().__init__(command_prefix=["/", "!", "시이 "], intents=intents, case_insensitive=True)
2224

2325
async def on_ready(self):
2426
print(f"Logged in as {self.user}")
2527
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="류현준 난간 "))
2729
await self.tree.sync()
28-
kb = DiscordpyKoreanbots(self,
29-
run_task=True)
30+
kb = DiscordpyKoreanbots(self,run_task=True)
3031
ss = self.guilds
3132
print(ss)
3233
simulate_stock_market.start()
@@ -40,6 +41,25 @@ def __init__(self):
4041
self.detect_swearing = False
4142

4243

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+
4363
json_file_path = 'bot_info.json'
4464
attendance_file = 'attendance.json'
4565
intents = discord.Intents.all()
@@ -60,7 +80,7 @@ def __init__(self):
6080
count_FILE = 'count.json'
6181
start_time = datetime.now()
6282
settings = BotSettings()
63-
83+
intents.message_content = True
6484

6585

6686
async def load_datas():
@@ -513,12 +533,6 @@ async def view_stocks(interaction: discord.Interaction):
513533
await interaction.send("보유한 주식이 없습니다.")
514534

515535

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-
522536

523537
@bot.hybrid_command(name='업다운시작', description="업다운 개임!(베타)")
524538
async def start_game(interaction: discord.Interaction):
@@ -749,10 +763,10 @@ async def hert(interaction: discord.Interaction):
749763

750764
@bot.hybrid_command(name='공지사항', description="시이봇의 공지를 볼 수 있어요!")
751765
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)
753767
embed.add_field(name="시이봇 개발 안내", value="시이봇 점검(개발) 기간은 매일 약 오후2시 부터 오후 6시 입니다. 이때는 시이봇이 멈출수도 있으니 양해 부탁드립니다.",
754768
inline=False)
755-
embed.add_field(name="시이봇 공식 사이트 개발 공지", value="이번에 shii.me 도매인을 얻었습니다. 그래서 현재 사이트 개발중 이니 많은관심 부탁드립니다!",
769+
embed.add_field(name="/번역 관련 공지 (중요)", value="현제, /번역 커멘드는 네이버의 파파고 openapi 를 사용하여 개발하였습니다. 그러나 파파고 번역 api가 2월 29일자로 서비스가 종료되어, 2월 29일자 이후로는 /번역이 사용이 불가하여, 2월 28일자로 /번역 서비스를 종료함을 알려드립니다. 죄송합니다.",
756770
inline=False)
757771
await interaction.send(embed=embed)
758772

@@ -874,15 +888,15 @@ async def help(interaction: discord.Interaction):
874888
embed.set_thumbnail(url='https://cdn.litt.ly/images/d7qircjSN5w6FNgD5Oh57blUjrfbBmCj?s=1200x1200&m=outside&f=webp')
875889
embed.add_field(name="**일반**", value="핑, 하트, 번역, 패치노트, 계산, 인원통계, 타이머, 프로필, 급식, 메모쓰기, 메모불러오기, 공지사항, 패치노트, 카운트", inline=False)
876890
embed.add_field(name="**검색**", value="네이버검색, 유튜브검색, 블로그검색, 애니검색", inline=False)
877-
embed.add_field(name="**재미**", value="고양이 ,알려주기, 급식, 호감도확인, 호감도도움말, 가위바위보, 광질, 주사위, 업다운시작, 업다운, 설날, 이모지", inline=False)
891+
embed.add_field(name="**재미**", value="고양이 ,알려주기, 급식, 호감도확인, 호감도도움말, 가위바위보, 광질, 주사위, 업다운시작, 업다운, 이모지, 골라", inline=False)
878892
embed.add_field(name="**주식**", value="주식매수, 주식매도, 가격보기, 자본", inline=False)
879893
embed.add_field(name="**보이스**", value="음성채널입장, 음성채널퇴장", inline=False)
880894
embed.add_field(name="**관리**", value="내정보, 프로필, 클리어, 임베드생성, 욕설필터링", inline=False)
881895
embed.add_field(name="", value="", inline=False)
882896
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)")
884898
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")
886900
await interaction.send(embed=embed)
887901

888902

@@ -894,6 +908,7 @@ async def hhlep(interaction: discord.Interaction):
894908
embed.add_field(name="호감도 상승법", value="/시이야, /알려주기 커멘드에서 각각 한번 실행 시킬떄 마다 1,2 씩 상승합니다.", inline=False)
895909
await interaction.send(embed=embed)
896910

911+
897912
@bot.hybrid_command(name='욕설필터링', description="욕설필터링기능을 끄고 킵니다.(관리자 권한 필요)")
898913
async def toggle_swearing_detection(interaction: discord.Interaction):
899914
if interaction.author.guild_permissions.manage_messages:
@@ -904,11 +919,18 @@ async def toggle_swearing_detection(interaction: discord.Interaction):
904919
await interaction.send("관리자만 욕설 감지 설정을 변경할 수 있습니다.")
905920

906921

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+
907929

908930
@bot.hybrid_command(name="패치노트", description="시이봇 패치노트 보기")
909931
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)
912934
embed.add_field(name="버그 수정", value="없음", inline=False)
913935
await interaction.send(embed=embed)
914936

@@ -1001,8 +1023,13 @@ async def on_message(message):
10011023
happiness_manager.increment_user_happiness(server_id, user_id, amount=1)
10021024
happiness_manager.save_to_file()
10031025
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
10041030
word = {
10051031
f'{message.author.display_name}': f"저가 {message.author.display_name} 님을 모를리 없죠!",
1032+
'정보': f'지금 시이는 `{len(bot.guilds)}` 개의 서버에서 `{total_member_count}명` 분들을 위해 일하고 있어요!',
10061033
'hello': '안녕하세욧!',
10071034
'안녕': '안녕하세요. 시이입니다!',
10081035
'누구야': '안녕하세요. shii입니다!',
@@ -1012,7 +1039,7 @@ async def on_message(message):
10121039
'게임': '게임하면 또 마크랑 원신을 빼놀수 없죠!',
10131040
'ㅋㅋㅋ': 'ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ',
10141041
'이스터에그': '아직 방장님이 말 하지 말라고 했는데....아직 비밀이예욧!',
1015-
'패치버전': '패치버전 v2.16.8',
1042+
'패치버전': '패치버전 v2.16.9',
10161043
'과자': '음...과자하니까 과자 먹고 싶당',
10171044
'뭐해?': '음.....일하죠 일! 크흠',
10181045
'음성채널': '음성채널는 현재 방장이 돈이 없어서 불가능 합니다ㅠㅠ',
@@ -1081,26 +1108,4 @@ def get_time():
10811108
return datetime.today().strftime("%H시 %M분 %S초")
10821109

10831110

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-
11061111
bot.run()

0 commit comments

Comments
 (0)