-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimedico.py
143 lines (138 loc) · 7.08 KB
/
timedico.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import cv2
import os
from PIL import Image
import pytesseract
import discord
from discord.ext import commands
from gtts import gTTS
__author__ = 'info-lab'
client = discord.Client()
@client.event
async def on_ready():
print(client.user.id)
print("ready")
game = discord.Game("\'타임머신\' 독서")
await client.change_presence(status=discord.Status.online, activity=game)
@client.event
async def on_message(message):
#책 1
if message.content.startswith("!책 1"):
await message.channel.send(file=discord.File("ta1.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta1.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta1.mp3')
embed = discord.Embed(title="타임머신 1장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta1.mp3")
await message.channel.send(file=file)
#책 2
elif message.content.startswith("!책 2"):
await message.channel.send(file=discord.File("ta2.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta2.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta2.mp3')
embed = discord.Embed(title="타임머신 2장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta2.mp3")
await message.channel.send(file=file)
#책 3
elif message.content.startswith("!책 3"):
await message.channel.send(file=discord.File("ta3.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta3.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta3.mp3')
embed = discord.Embed(title="타임머신 3장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta3.mp3")
await message.channel.send(file=file)
#책 4
elif message.content.startswith("!책 4"):
await message.channel.send(file=discord.File("ta4.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta4.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta4.mp3')
embed = discord.Embed(title="타임머신 4장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta4.mp3")
await message.channel.send(file=file)
#책 5
elif message.content.startswith("!책 5"):
await message.channel.send(file=discord.File("ta5.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta5.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta5.mp3')
embed = discord.Embed(title="타임머신 5장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta5.mp3")
await message.channel.send(file=file)
#책 6
elif message.content.startswith("!책 6"):
await message.channel.send(file=discord.File("ta6.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta6.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta6.mp3')
embed = discord.Embed(title="타임머신 6장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta6.mp3")
await message.channel.send(file=file)
#책 7
elif message.content.startswith("!책 7"):
await message.channel.send(file=discord.File("ta7.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta7.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta7.mp3')
embed = discord.Embed(title="타임머신 7장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta7.mp3")
await message.channel.send(file=file)
#책 8
elif message.content.startswith("!책 8"):
await message.channel.send(file=discord.File("ta8.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta8.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta8.mp3')
embed = discord.Embed(title="타임머신 8장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta8.mp3")
await message.channel.send(file=file)
#책 9
elif message.content.startswith("!책 9"):
await message.channel.send(file=discord.File("ta9.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta9.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta9.mp3')
embed = discord.Embed(title="타임머신 9장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta9.mp3")
await message.channel.send(file=file)
#책 10
elif message.content.startswith("!책 10"):
await message.channel.send(file=discord.File("ta10.png"))
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
text = pytesseract.image_to_string("ta10.png", lang='kor')
tts = gTTS( text, lang='ko', slow=False )
tts.save('ta10.mp3')
embed = discord.Embed(title="타임머신 10장", description=text, color=0x62c1cc)
embed.set_footer(text="tts로 읽는 타임머신")
await message.channel.send("타임머신", embed=embed)
file = discord.File("ta10.mp3")
await message.channel.send(file=file)
client.run(" ")