├── BotFather commands.txt
├── LICENSE
├── README.md
├── botapiconfig.py
├── main.py
├── native-install.py
├── native-start.py
├── requirements.txt
├── stickers
├── 4354353454.webp
├── 54754745745.webp
├── 5568568568568.webp
├── 568568658568.webp
├── 56868568568.webp
├── 65856865865.webp
├── 65865856856.webp
├── 658658658.webp
├── 68658658658.webp
├── 745745745754.webp
├── 754745745.webp
├── dhfdhdfhf.webp
├── fgjgfjfgj.webp
├── fhfdhfdh.webp
├── fjfgjurturt.webp
├── fjgfjfgjgfj.webp
├── hdfhdfhdfh.webp
├── jfgjturtur.webp
├── jfjfgjfgjg.webp
├── rtutrurtjfgj.webp
├── rtutrurtutru.webp
├── rutrutrutrurt.webp
├── sticker-animenazi.webp
├── sticker.webp
├── trutrutrur.webp
├── urturturtutru.webp
└── urturutrurt.webp
├── venv-install.py
└── venv-start.py
/BotFather commands.txt:
--------------------------------------------------------------------------------
1 | start - Документация по использованию
2 | chatgpt3 - Генератор текста с использованием модели GPT 3.5
3 | dalle2 - Генератор картинок
4 | log - Выгрузить логи бота с сервера
5 | addadmin - Добавить аккаунт в чисто Администраторов по UserID
6 | removeadmin - Удалить аккаунт из числа Администраторов по UserID
7 | ban - Забанить аккаунт по UserID
8 | unban - Разбанить аккаунт по UserID
9 | id - Информация о вас
10 | adminlist - Список Администраторов
11 | reboot - Перезапустить бота
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://www.youtube.com/@avencores/) [](https://t.me/avencoresyt) [](https://vk.com/avencoresvk)
2 | # ChatGPT, DALLE-2 and Whisper Telegram Bot for Telegram
3 | 
4 |
5 | # 🎯 Команды
6 | + `start`: **Документация по использованию**
7 | + `chatgpt3`: **Генератор текста с использованием модели GPT 3.5**
8 | + `dalle2`: **Генератор картинок**
9 | + `log`: **Выгрузить логи бота с сервера**
10 | + `addadmin`: **Добавить аккаунт в чисто Администраторов по UserID**
11 | + `removeadmin`: **Удалить аккаунт из числа Администраторов по UserID**
12 | + `ban`: **Забанить аккаунт по UserID**
13 | + `unban`: **Разбанить аккаунт по UserID**
14 | + `id`: **Информация о вас**
15 | + `adminlist`: **Список Администраторов**
16 | + `reboot`: **Перезапустить бота**
17 |
18 | # 🧬 Установка
19 | + `Fedora`: **sudo dnf install git ffmpeg**
20 | + `Arch`: **sudo pacman -S git python-virtualenv ffmpeg**
21 | + `Ubuntu/Debian`: **sudo apt install git python3.10-venv ffmpeg**
22 | - **`git clone https://github.com/AvenCores/openai-api-telegram-bot-public`**
23 | - **`cd openai-api-telegram-bot-public`**
24 | - **`python3 venv-install.py`** or **`python3 native-install.py`**
25 |
26 | # 🛡️ Запуск
27 | + **`python3 venv-start.py`** or **`python3 native-start.py`**
28 |
29 | # 🖤 Пример работы
30 | 
31 |
32 | # 💰 Поддержать автора
33 | + **SBER**: 2202 2050 7215 4401
34 | + **VTB**: 2200 2404 1001 8580
35 |
--------------------------------------------------------------------------------
/botapiconfig.py:
--------------------------------------------------------------------------------
1 | telegrambotapi = ""
2 | openaiapi = ""
3 | session_key = ""
4 |
5 | botname = "avencoreschatgpt_bot"
6 | timebot = "Europe/Moscow"
7 |
8 | q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,qw = ['dhfdhdfhf.webp', 'fgjgfjfgj.webp', 'fhfdhfdh.webp', 'fjfgjurturt.webp', 'hdfhdfhdfh.webp', 'rtutrurtutru.webp', 'sticker.webp', 'sticker-animenazi.webp', 'trutrutrur.webp', 'urturturtutru.webp', 'rutrutrutrurt.webp', 'jfjfgjfgjg.webp', 'fjgfjfgjgfj.webp', 'jfgjturtur.webp', 'rtutrurtjfgj.webp', 'urturutrurt.webp', '54754745745.webp', '5568568568568.webp', '568568658568.webp', '56868568568.webp', '65865856856.webp', '65856865865.webp', '658658658.webp', '68658658658.webp', '754745745.webp', '745745745754.webp', '4354353454.webp']
9 | numbers = (q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,qw)
10 |
11 | chatgpt4_test = "yes" # yes/not
12 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | from datetime import datetime
5 | from gpt4free import Provider
6 | from pytz import timezone
7 | from telebot import types
8 | from telebot import util
9 | from sys import platform
10 | import requests
11 | import gpt4free
12 | import telebot
13 | import random
14 | import openai
15 | import shutil
16 | import pydub
17 | import time
18 | import sys
19 | import os
20 |
21 | from botapiconfig import openaiapi, telegrambotapi, session_key, botname, timebot, numbers
22 |
23 | openai.api_key = openaiapi
24 | bot = telebot.TeleBot(telegrambotapi)
25 |
26 | last_messages_chatgpt3 = {}
27 | last_messages_dalletwo = {}
28 | last_whisper = {}
29 |
30 | start_time = time.time()
31 |
32 |
33 | ADMIN_USERS_FILE = "admin_list.txt"
34 |
35 | def load_admin_list():
36 | adminsid = []
37 | try:
38 | with open(ADMIN_USERS_FILE, "r") as file:
39 | for line in file:
40 | adminsid.append(line.strip())
41 | except FileNotFoundError:
42 | pass
43 | return adminsid
44 |
45 | def save_admin_users(adminsid):
46 | with open(ADMIN_USERS_FILE, "w") as file:
47 | for user_id in adminsid:
48 | file.write(str(user_id) + "\n")
49 |
50 | admin_list = load_admin_list()
51 |
52 | BANNED_USERS_FILE = "banned_users.txt"
53 |
54 | def load_banned_users():
55 | banned_users = []
56 | try:
57 | with open(BANNED_USERS_FILE, "r") as file:
58 | for line in file:
59 | banned_users.append(line.strip())
60 | except FileNotFoundError:
61 | pass
62 | return banned_users
63 |
64 | def save_banned_users(banned_users):
65 | with open(BANNED_USERS_FILE, "w") as file:
66 | for user_id in banned_users:
67 | file.write(str(user_id) + "\n")
68 |
69 | banned_users = load_banned_users()
70 |
71 | def mainstarter():
72 | @bot.message_handler(commands=['addadmin'])
73 | def ban_user(message):
74 | if len(admin_list) > 0 and str(message.from_user.id) in admin_list:
75 | if message.text.lower() == "/addadmin":
76 | markup = types.InlineKeyboardMarkup()
77 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
78 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
79 | markup.add(button1)
80 | markup.add(button2)
81 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
82 | if message.text.lower() == f"/addadmin@{botname}":
83 | markup = types.InlineKeyboardMarkup()
84 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
85 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
86 | markup.add(button1)
87 | markup.add(button2)
88 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
89 | if len(admin_list) > 0 and str(message.from_user.id) in admin_list:
90 | user_id = message.text.split()[1]
91 | admin_list.append(user_id)
92 | markup = types.InlineKeyboardMarkup()
93 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
94 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
95 | markup.add(button1)
96 | markup.add(button2)
97 | bot.send_message(message.chat.id, f"✅ Аккаунт {user_id} был успешно добавлен в Администраторы!", reply_markup=markup, parse_mode="Markdown")
98 | save_admin_users(admin_list)
99 | os.execl(sys.executable, 'python', 'main.py')
100 | else:
101 | markup = types.InlineKeyboardMarkup()
102 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
103 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
104 | markup.add(button1)
105 | markup.add(button2)
106 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
107 |
108 | @bot.message_handler(commands=['removeadmin'])
109 | def unban_user(message):
110 | if len(admin_list) > 0 and str(message.from_user.id) in admin_list:
111 | if message.text.lower() == "/removeadmin":
112 | markup = types.InlineKeyboardMarkup()
113 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
114 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
115 | markup.add(button1)
116 | markup.add(button2)
117 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
118 | user_id = message.text.split()[1]
119 |
120 | if message.text.lower() == f"/removeadmin@{botname}":
121 | markup = types.InlineKeyboardMarkup()
122 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
123 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
124 | markup.add(button1)
125 | markup.add(button2)
126 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
127 |
128 | if user_id in admin_list:
129 | new_lines = [line for line in admin_list if user_id not in line]
130 | save_admin_users(new_lines)
131 | markup = types.InlineKeyboardMarkup()
132 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
133 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
134 | markup.add(button1)
135 | markup.add(button2)
136 | bot.send_message(message.chat.id, f"🛑 Вы успешно удалили аккаунт {user_id} из Администраторов!", reply_markup=markup, parse_mode="Markdown")
137 | os.execl(sys.executable, 'python', 'main.py')
138 | else:
139 | markup = types.InlineKeyboardMarkup()
140 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
141 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
142 | markup.add(button1)
143 | markup.add(button2)
144 | bot.send_message(message.chat.id, f"Аккаунт {user_id} не был Администратором.", reply_markup=markup, parse_mode="Markdown")
145 | else:
146 | markup = types.InlineKeyboardMarkup()
147 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
148 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
149 | markup.add(button1)
150 | markup.add(button2)
151 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
152 |
153 | @bot.message_handler(commands=['adminlist'])
154 | def ban_user(message):
155 | if str(message.from_user.id) in admin_list:
156 | listprint = "\n".join(admin_list)
157 | markup = types.InlineKeyboardMarkup()
158 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
159 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
160 | markup.add(button1)
161 | markup.add(button2)
162 | bot.send_message(message.chat.id, text=f"👨 *UserID Администраторов*\n\n{listprint}", reply_markup=markup, parse_mode="Markdown")
163 | else:
164 | markup = types.InlineKeyboardMarkup()
165 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
166 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
167 | markup.add(button1)
168 | markup.add(button2)
169 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
170 |
171 | @bot.message_handler(commands=['ban'])
172 | def ban_user(message):
173 | if str(message.from_user.id) in admin_list:
174 | if message.text.lower() == "/ban":
175 | markup = types.InlineKeyboardMarkup()
176 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
177 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
178 | markup.add(button1)
179 | markup.add(button2)
180 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
181 | if message.text.lower() == f"/ban@{botname}":
182 | markup = types.InlineKeyboardMarkup()
183 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
184 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
185 | markup.add(button1)
186 | markup.add(button2)
187 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
188 | else:
189 | user_id = message.text.split()[1]
190 | banned_users.append(user_id)
191 | markup = types.InlineKeyboardMarkup()
192 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
193 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
194 | markup.add(button1)
195 | markup.add(button2)
196 | bot.send_message(message.chat.id, f"🛑 Аккаунт {user_id} был успешно заблокирован!", reply_markup=markup, parse_mode="Markdown")
197 | save_banned_users(banned_users)
198 | os.execl(sys.executable, 'python', 'main.py')
199 | else:
200 | markup = types.InlineKeyboardMarkup()
201 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
202 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
203 | markup.add(button1)
204 | markup.add(button2)
205 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
206 |
207 | @bot.message_handler(commands=['unban'])
208 | def unban_user(message):
209 | if str(message.from_user.id) in admin_list:
210 | if message.text.lower() == "/unban":
211 | markup = types.InlineKeyboardMarkup()
212 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
213 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
214 | markup.add(button1)
215 | markup.add(button2)
216 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
217 | user_id = message.text.split()[1]
218 |
219 | if message.text.lower() == f"/unban@{botname}":
220 | markup = types.InlineKeyboardMarkup()
221 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
222 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
223 | markup.add(button1)
224 | markup.add(button2)
225 | bot.send_message(message.chat.id, text="❌ *Упс, команда оказалось пустой!*", reply_markup=markup, parse_mode="Markdown")
226 |
227 | if user_id in banned_users:
228 | new_lines = [line for line in banned_users if user_id not in line]
229 | save_banned_users(new_lines)
230 | markup = types.InlineKeyboardMarkup()
231 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
232 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
233 | markup.add(button1)
234 | markup.add(button2)
235 | bot.send_message(message.chat.id, f"✅ Вы разблокировали аккаунт {user_id}.", reply_markup=markup, parse_mode="Markdown")
236 | os.execl(sys.executable, 'python', 'main.py')
237 | else:
238 | markup = types.InlineKeyboardMarkup()
239 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
240 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
241 | markup.add(button1)
242 | markup.add(button2)
243 | bot.send_message(message.chat.id, f"Аккаунт {user_id} не был заблокирован.", reply_markup=markup, parse_mode="Markdown")
244 | else:
245 | markup = types.InlineKeyboardMarkup()
246 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
247 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
248 | markup.add(button1)
249 | markup.add(button2)
250 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
251 |
252 | @bot.message_handler(commands=['reboot'])
253 | def handle_reboot(message):
254 | if str(message.from_user.id) in admin_list:
255 | markup = types.InlineKeyboardMarkup()
256 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
257 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
258 | markup.add(button1)
259 | markup.add(button2)
260 | bot.send_message(message.chat.id, text=f"✅ *Бот был успешно перезапущен!*", reply_markup=markup, parse_mode="Markdown")
261 | os.execl(sys.executable, 'python', 'main.py')
262 | else:
263 | markup = types.InlineKeyboardMarkup()
264 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
265 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
266 | markup.add(button1)
267 | markup.add(button2)
268 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
269 |
270 | @bot.message_handler(commands=['start'])
271 | def start_message(message):
272 | if message.chat.type != 'private':
273 | if message.text.lower() == "/start":
274 | markup = types.InlineKeyboardMarkup()
275 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
276 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
277 | markdown = """🚨 *ПРЕДУПРЕЖДЕНИЕ*: Пожалуйста, обратите внимание, что команда `/start` доступна только в *личных сообщениях* с данным ботом. Использование этой команды в групповых чатах или каналах может вызвать непредвиденные ошибки и нарушения конфиденциальности.
278 |
279 | 🙏 Пожалуйста, следуйте этому правилу, чтобы избежать любых проблем. Если у вас есть какие-либо вопросы или проблемы, пожалуйста, обратитесь к нашей документации или напишите в техническую поддержку. Спасибо за понимание!"""
280 | markup.add(button1)
281 | markup.add(button2)
282 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
283 |
284 | elif message.text.lower() == f"/start@{botname}":
285 | markup = types.InlineKeyboardMarkup()
286 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
287 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
288 | markdown = f"""🚨 *ПРЕДУПРЕЖДЕНИЕ*: Пожалуйста, обратите внимание, что команда `/start@{botname}` доступна только в *личных сообщениях* с данным ботом. Использование этой команды в групповых чатах или каналах может вызвать непредвиденные ошибки и нарушения конфиденциальности.
289 |
290 | 🙏 Пожалуйста, следуйте этому правилу, чтобы избежать любых проблем. Если у вас есть какие-либо вопросы или проблемы, пожалуйста, обратитесь к нашей документации или напишите в техническую поддержку. Спасибо за понимание!"""
291 | markup.add(button1)
292 | markup.add(button2)
293 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
294 | return
295 |
296 | markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
297 | button1 = types.InlineKeyboardButton("🚀 Мои проекты")
298 | button2 = types.InlineKeyboardButton("💬 Мои чаты")
299 | button3 = types.InlineKeyboardButton("💰 Поддержать автора монетой")
300 | button4 = types.InlineKeyboardButton("🔧 Техническая поддержка")
301 | button5 = types.InlineKeyboardButton("📃 Исходный код")
302 | button6 = types.InlineKeyboardButton("📈 Статус бота")
303 | markup.add(button1, button2, button3, button4, button5, button6)
304 | random_number = random.choice(numbers)
305 | sticker = open(f"stickers/{random_number}", "rb")
306 | bot.send_sticker(message.chat.id, sticker)
307 | markdown = """Привет друг! 👋\n\nДанный телеграм бот основан на технологии ChatGPT 3.5, DALLE-2 и Whisper. 💻\n\nВы можете добавить данного бота к себе в чат и так же полноценно использовать, но учтите, что ограничения бота будут действовать на всех участников беседы сразу. 🤖\n\n*Что такое ChatGPT?* ❓\nChatGPT - это модель языкового обработки, разработанная OpenAI. Она была обучена на множестве текстов и может генерировать тексты, отвечать на вопросы и выполнять другие задачи обработки языка. 💡\n\n*Что такое DALLE-2?* ❓\nDALLE-2 - это продвинутая модель глубокого обучения, созданная OpenAI, которая может генерировать изображения и текстовые описания на основе заданного текстового ввода. 💡\n\n*Что такое Whisper?* ❓\nWhisper - это модель, которая позволяет переводить голосовое сообщение в текст.\n\n*Как задать вопрос ChatGPT 3.5?* ❓\nЛегко! Просто напиши /chatgpt3 ВАШ-ЗАПРОС 😉\n\n*Как получить картинку от DALLE-2?* ❓\nЛегко! Просто напиши /dalle2 ВАШ-ЗАПРОС 😉\n\n*Как воспользоваться Whisper?* ❓\nЛегко! Просто отправь или перешли голосовое сообщение боту 😉"""
308 | bot.send_message(message.chat.id, markdown, reply_markup=markup, parse_mode="Markdown")
309 |
310 | @bot.message_handler(commands=['dalle2'])
311 | def dalletwo(message):
312 | if len(banned_users) > 0 and str(message.from_user.id) in banned_users:
313 | markup = types.InlineKeyboardMarkup()
314 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
315 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
316 | markup.add(button1)
317 | markup.add(button2)
318 | bot.send_message(message.chat.id, "🛑 Данная функция заблокирована для вашего аккаунта!", reply_markup=markup, parse_mode="Markdown")
319 | return
320 | if message.text.lower() == f"/dalle2@{botname}":
321 | markup = types.InlineKeyboardMarkup()
322 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
323 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
324 | markdown = f"""🚫 *Ошибка:* Команда `/dalle2@{botname}` оказалась пустой, запрос не может быть выполнен.
325 |
326 | Пожалуйста, укажите текст после команды `/dalle2@{botname}`, чтобы DALLE-2 мог обработать ваш запрос. Если проблема сохраняется, обратитесь к документации или к нашей службе поддержки. 🤖"""
327 | markup.add(button1)
328 | markup.add(button2)
329 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
330 | if message.text.lower() == "/dalle2":
331 | markup = types.InlineKeyboardMarkup()
332 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
333 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
334 | markdown = """🚫 *Ошибка*: Команда `/dalle2` оказалась пустой, запрос не может быть выполнен.
335 |
336 | Пожалуйста, укажите текст после команды `/dalle2`, чтобы DALLE-2 мог обработать ваш запрос. Если проблема сохраняется, обратитесь к документации или к нашей службе поддержки. 🤖"""
337 | markup.add(button1)
338 | markup.add(button2)
339 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
340 | elif len(message.text.split(maxsplit=1)[1]) > 300:
341 | markup = types.InlineKeyboardMarkup()
342 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
343 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
344 | markdown = "🚫 *Сообщение слишком длинное! Максимальная длина сообщения - 300 символов.*"
345 | markup.add(button1)
346 | markup.add(button2)
347 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
348 | elif message.chat.id in last_messages_dalletwo and time.time() - last_messages_dalletwo[message.chat.id] < 30:
349 | markup = types.InlineKeyboardMarkup()
350 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
351 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
352 | markdown = "🚫 *Слишком быстро! Пожалуйста, подождите 30 секунд перед отправкой нового сообщения.*"
353 | markup.add(button1)
354 | markup.add(button2)
355 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
356 | else:
357 |
358 | if message.from_user.id in last_messages_dalletwo:
359 | elapsed_time = time.time() - last_messages_dalletwo[message.from_user.id]
360 | if elapsed_time < 30:
361 | time.sleep(30 - elapsed_time)
362 |
363 | msg = bot.reply_to(message, "🔎 Идет загрузка, подождите...")
364 |
365 | last_messages_dalletwo[message.chat.id] = time.time()
366 |
367 | try:
368 | response = openai.Image.create(
369 | prompt=message.text.split(maxsplit=1)[1],
370 | n=1,
371 | size="1024x1024")
372 |
373 | username = message.from_user.first_name
374 | output = response['data'][0]['url']
375 | inputuser = message.text.split(maxsplit=1)[1]
376 | bot.delete_message(message.chat.id, msg.message_id)
377 | bot.reply_to(message, text="✅ Ответ получен!")
378 |
379 |
380 | bot.send_message(message.chat.id, text=f"👨 *Запрос отправлен пользователем*: `{username}`\n\n🎈 *Айди сообщения*: `{message.message_id}`\n\n🤔 *Запрос*: `{inputuser}`\n\n👾 *Ответ от DALLE-2*: [картинка от DALLE-2]({output})", parse_mode="Markdown")
381 |
382 |
383 | message_date = datetime.fromtimestamp(message.date, timezone(timebot))
384 | message_date_string = message_date.strftime('%Y-%m-%d %H:%M:%S')
385 |
386 | f = open("chatlog.txt", "a")
387 | f.writelines('---------------------------------------------------------------------------')
388 | f.writelines('\n')
389 | f.writelines('Model: DALLE-2')
390 | f.writelines('\n')
391 | f.writelines(f'ChatID: {message.chat.id}')
392 | f.writelines('\n')
393 | f.writelines(f'MessageID: {message.message_id}')
394 | f.writelines('\n')
395 | f.writelines(f'UserID: {message.from_user.id}')
396 | f.writelines('\n')
397 | f.writelines(f'Username: {message.from_user.username}')
398 | f.writelines('\n')
399 | f.writelines(f'Date and Time: {message_date_string}')
400 | f.writelines('\n')
401 | f.writelines(f'Prompt: {message.text.split(maxsplit=1)[1]}')
402 | f.writelines('\n')
403 | f.writelines(f'AI reply: {output}')
404 | f.writelines('\n')
405 | f.writelines('---------------------------------------------------------------------------')
406 | f.writelines('\n\n')
407 | f.close
408 |
409 | except openai.error.Timeout as e:
410 | print(e)
411 | bot.delete_message(message.chat.id, msg.message_id)
412 | markup = types.InlineKeyboardMarkup()
413 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
414 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
415 | markup.add(button1)
416 | markup.add(button2)
417 | markdown = f"❌ *OpenAI API не смог обработать запрос*: `{e}`"
418 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
419 |
420 | except openai.error.APIError as e:
421 | print(e)
422 | bot.delete_message(message.chat.id, msg.message_id)
423 | markup = types.InlineKeyboardMarkup()
424 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
425 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
426 | markup.add(button1)
427 | markup.add(button2)
428 | markdown = f"❌ *OpenAI API вернул ошибку API*: `{e}`"
429 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
430 |
431 | except openai.error.APIConnectionError as e:
432 | print(e)
433 | bot.delete_message(message.chat.id, msg.message_id)
434 | markup = types.InlineKeyboardMarkup()
435 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
436 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
437 | markup.add(button1)
438 | markup.add(button2)
439 | markdown = f"❌ *Невозможно подключиться к OpenAI API*: `{e}`"
440 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
441 |
442 | except openai.error.InvalidRequestError as e:
443 | print(e)
444 | bot.delete_message(message.chat.id, msg.message_id)
445 | markup = types.InlineKeyboardMarkup()
446 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
447 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
448 | markup.add(button1)
449 | markup.add(button2)
450 | markdown = f"❌ *OpenAI API запрос оказался недействительным*: `{e}`"
451 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
452 |
453 | except openai.error.AuthenticationError as e:
454 | print(e)
455 | bot.delete_message(message.chat.id, msg.message_id)
456 | markup = types.InlineKeyboardMarkup()
457 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
458 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
459 | markup.add(button1)
460 | markup.add(button2)
461 | markdown = f"❌ *OpenAI API запрос не был авторизован*: `{e}`"
462 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
463 |
464 | except openai.error.PermissionError as e:
465 | print(e)
466 | bot.delete_message(message.chat.id, msg.message_id)
467 | markup = types.InlineKeyboardMarkup()
468 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
469 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
470 | markup.add(button1)
471 | markup.add(button2)
472 | markdown = f"❌ *Запрос OpenAI API не был разрешен*: `{e}`"
473 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
474 |
475 | except openai.error.RateLimitError as e:
476 | print(e)
477 | bot.delete_message(message.chat.id, msg.message_id)
478 | markup = types.InlineKeyboardMarkup()
479 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
480 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
481 | markup.add(button1)
482 | markup.add(button2)
483 | markdown = f"❌ *Превышены лимиты OpenAI API*: `{e}`"
484 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
485 |
486 | @bot.message_handler(commands=['chatgpt3'])
487 | def chatgpt3(message):
488 | if len(banned_users) > 0 and str(message.from_user.id) in banned_users:
489 | markup = types.InlineKeyboardMarkup()
490 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
491 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
492 | markup.add(button1)
493 | markup.add(button2)
494 | bot.send_message(message.chat.id, "🛑 Данная функция заблокирована для вашего аккаунта!", reply_markup=markup, parse_mode="Markdown")
495 | return
496 | if message.text.lower() == f"/chatgpt3@{botname}":
497 | markup = types.InlineKeyboardMarkup()
498 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
499 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
500 | markdown = f"""🚫 *Ошибка*: Команда `/chatgpt3@{botname}` оказалась пустой, запрос не может быть выполнен.
501 |
502 | Пожалуйста, укажите текст после команды `/chatgpt3@{botname}`, чтобы ChatGPT мог обработать ваш запрос. Если проблема сохраняется, обратитесь к документации или к нашей службе поддержки. 🤖"""
503 | markup.add(button1)
504 | markup.add(button2)
505 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
506 | if message.text.lower() == "/chatgpt3":
507 | markup = types.InlineKeyboardMarkup()
508 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
509 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
510 | markdown = """🚫 *Ошибка*: Команда `/chatgpt3` оказалась пустой, запрос не может быть выполнен.
511 |
512 | Пожалуйста, укажите текст после команды `/chatgpt3`, чтобы ChatGPT мог обработать ваш запрос. Если проблема сохраняется, обратитесь к документации или к нашей службе поддержки. 🤖"""
513 | markup.add(button1)
514 | markup.add(button2)
515 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
516 | elif len(message.text.split(maxsplit=1)[1]) > 300:
517 | markup = types.InlineKeyboardMarkup()
518 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
519 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
520 | markdown = "🚫 *Сообщение слишком длинное! Максимальная длина сообщения - 300 символов.*"
521 | markup.add(button1)
522 | markup.add(button2)
523 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
524 | elif message.chat.id in last_messages_chatgpt3 and time.time() - last_messages_chatgpt3[message.chat.id] < 30:
525 | markup = types.InlineKeyboardMarkup()
526 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
527 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
528 | markdown = "🚫 *Слишком быстро! Пожалуйста, подождите 30 секунд перед отправкой нового сообщения.*"
529 | markup.add(button1)
530 | markup.add(button2)
531 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
532 | else:
533 |
534 | if message.from_user.id in last_messages_chatgpt3:
535 | elapsed_time = time.time() - last_messages_chatgpt3[message.from_user.id]
536 | if elapsed_time < 30:
537 | time.sleep(30 - elapsed_time)
538 |
539 | msg = bot.reply_to(message, "🔎 Идет загрузка, подождите...")
540 |
541 | last_messages_chatgpt3[message.chat.id] = time.time()
542 |
543 | try:
544 | response = openai.ChatCompletion.create(
545 | model="gpt-3.5-turbo-16k",
546 | messages=[{"role": "user", "content": message.text.split(maxsplit=1)[1]}])
547 |
548 | total_tokens = response['usage']['total_tokens']
549 | output = response["choices"][0]["message"]["content"]
550 | username = message.from_user.first_name
551 | inputuser = message.text.split(maxsplit=1)[1]
552 | bot.delete_message(message.chat.id, msg.message_id)
553 | bot.reply_to(message, text="✅ Ответ получен!")
554 |
555 |
556 | if 'output' in locals():
557 | splitted_text = util.smart_split(output, chars_per_string=2000)
558 | for text in splitted_text:
559 | bot.send_message(message.chat.id, text=f"👨 Запрос отправлен пользователем: {username}\n\n🎈 Айди сообщения: {message.message_id}\n\n💰 Затрачено токенов: {total_tokens}\n\n🤔 Запрос: {inputuser}\n\n👾 Ответ от ChatGPT3: {text}")
560 |
561 | # model = ora.CompletionModel.create(name = 'gpt-3.5')
562 | # prompt = message.text
563 | # response = ora.Completion.create(model = model, prompt = prompt)
564 | # output = response.completion.choices[0].text
565 |
566 | # username = message.from_user.first_name
567 | # inputuser = message.text.split(maxsplit=1)[1]
568 | # bot.delete_message(message.chat.id, msg.message_id)
569 | # bot.reply_to(message, text="✅ Ответ получен!")
570 |
571 | # if 'output' in locals():
572 | # splitted_text = util.smart_split(output, chars_per_string=2000)
573 | # for text in splitted_text:
574 | # bot.send_message(message.chat.id, text=f"👨 Запрос отправлен пользователем: {username}\n\n🎈 Айди сообщения: {message.message_id}\n\n💰 Затрачено токенов: FREE\n\n🤔 Запрос: {inputuser}\n\n👾 Ответ от ChatGPT3: {text}")
575 |
576 | message_date = datetime.fromtimestamp(message.date, timezone(timebot))
577 | message_date_string = message_date.strftime('%Y-%m-%d %H:%M:%S')
578 |
579 | f = open("chatlog.txt", "a")
580 | f.writelines('---------------------------------------------------------------------------')
581 | f.writelines('\n')
582 | f.writelines('Model: ChatGPT3')
583 | f.writelines('\n')
584 | f.writelines(f'Tokens used: {total_tokens}')
585 | # f.writelines(f'Tokens used: FREE')
586 | f.writelines('\n')
587 | f.writelines(f'ChatID: {message.chat.id}')
588 | f.writelines('\n')
589 | f.writelines(f'MessageID: {message.message_id}')
590 | f.writelines('\n')
591 | f.writelines(f'UserID: {message.from_user.id}')
592 | f.writelines('\n')
593 | f.writelines(f'Username: {message.from_user.username}')
594 | f.writelines('\n')
595 | f.writelines(f'Date and Time: {message_date_string}')
596 | f.writelines('\n')
597 | f.writelines(f'Prompt: {message.text.split(maxsplit=1)[1]}')
598 | f.writelines('\n')
599 | f.writelines(f'AI reply: {output}')
600 | f.writelines('\n')
601 | f.writelines('---------------------------------------------------------------------------')
602 | f.writelines('\n\n')
603 | f.close
604 |
605 | # except Exception as e:
606 | # print(e)
607 | # bot.delete_message(message.chat.id, msg.message_id)
608 | # markup = types.InlineKeyboardMarkup()
609 | # button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
610 | # button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
611 | # markup.add(button1)
612 | # markup.add(button2)
613 | # markdown = f"❌ *Ora API не смог обработать запрос*: `{e}`"
614 | # bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
615 |
616 | except openai.error.Timeout as e:
617 | print(e)
618 | bot.delete_message(message.chat.id, msg.message_id)
619 | markup = types.InlineKeyboardMarkup()
620 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
621 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
622 | markup.add(button1)
623 | markup.add(button2)
624 | markdown = f"❌ *OpenAI API не смог обработать запрос*: `{e}`"
625 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
626 |
627 | except openai.error.APIError as e:
628 | print(e)
629 | bot.delete_message(message.chat.id, msg.message_id)
630 | markup = types.InlineKeyboardMarkup()
631 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
632 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
633 | markup.add(button1)
634 | markup.add(button2)
635 | markdown = f"❌ *OpenAI API вернул ошибку API*: `{e}`"
636 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
637 |
638 | except openai.error.APIConnectionError as e:
639 | print(e)
640 | bot.delete_message(message.chat.id, msg.message_id)
641 | markup = types.InlineKeyboardMarkup()
642 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
643 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
644 | markup.add(button1)
645 | markup.add(button2)
646 | markdown = f"❌ *Невозможно подключиться к OpenAI API*: `{e}`"
647 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
648 |
649 | except openai.error.InvalidRequestError as e:
650 | print(e)
651 | bot.delete_message(message.chat.id, msg.message_id)
652 | markup = types.InlineKeyboardMarkup()
653 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
654 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
655 | markup.add(button1)
656 | markup.add(button2)
657 | markdown = f"❌ *OpenAI API запрос оказался недействительным*: `{e}`"
658 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
659 |
660 | except openai.error.AuthenticationError as e:
661 | print(e)
662 | bot.delete_message(message.chat.id, msg.message_id)
663 | markup = types.InlineKeyboardMarkup()
664 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
665 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
666 | markup.add(button1)
667 | markup.add(button2)
668 | markdown = f"❌ *OpenAI API запрос не был авторизован*: `{e}`"
669 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
670 |
671 | except openai.error.PermissionError as e:
672 | print(e)
673 | bot.delete_message(message.chat.id, msg.message_id)
674 | markup = types.InlineKeyboardMarkup()
675 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
676 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
677 | markup.add(button1)
678 | markup.add(button2)
679 | markdown = f"❌ *Запрос OpenAI API не был разрешен*: `{e}`"
680 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
681 |
682 | except openai.error.RateLimitError as e:
683 | print(e)
684 | bot.delete_message(message.chat.id, msg.message_id)
685 | markup = types.InlineKeyboardMarkup()
686 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
687 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
688 | markup.add(button1)
689 | markup.add(button2)
690 | markdown = f"❌ *Превышены лимиты OpenAI API*: `{e}`"
691 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
692 |
693 |
694 | @bot.message_handler(commands=['log'])
695 | def logsend(message):
696 | if message.chat.type == 'private':
697 | if len(admin_list) > 0 and str(message.from_user.id) in admin_list:
698 | if os.path.isfile("chatlog.txt"):
699 | markup = types.InlineKeyboardMarkup()
700 | button1 = types.InlineKeyboardButton("✅ Да, отправь мне лог!", callback_data="yesdownload")
701 | button2 = types.InlineKeyboardButton("❌ Нет, я передумал!", callback_data="delerrorandmsguser")
702 | markup.add(button1)
703 | markup.add(button2)
704 | bot.send_message(message.chat.id, text="🤔 *Вы уверены, что хотите скачать логи?*", reply_markup=markup, parse_mode="Markdown")
705 | else:
706 | markup = types.InlineKeyboardMarkup()
707 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
708 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
709 | markup.add(button1)
710 | markup.add(button2)
711 | bot.send_message(message.chat.id, text="❌ *Увы, но на данный момент нету логов!*", reply_markup=markup, parse_mode="Markdown")
712 | else:
713 | markup = types.InlineKeyboardMarkup()
714 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
715 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
716 | markup.add(button1)
717 | markup.add(button2)
718 | bot.send_message(message.chat.id, text="❌ *Данная команда доступна только Администрации!*", reply_markup=markup, parse_mode="Markdown")
719 | elif message.chat.type in ['group', 'supergroup']:
720 | if message.text.lower() == "/log":
721 | markup = types.InlineKeyboardMarkup()
722 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
723 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
724 | markdown = """🚨 *ПРЕДУПРЕЖДЕНИЕ*: Пожалуйста, обратите внимание, что команда `/log` доступна только в *личных сообщениях* с данным ботом. Использование этой команды в групповых чатах или каналах может вызвать непредвиденные ошибки и нарушения конфиденциальности.
725 |
726 | 🙏 Пожалуйста, следуйте этому правилу, чтобы избежать любых проблем. Если у вас есть какие-либо вопросы или проблемы, пожалуйста, обратитесь к нашей документации или напишите в техническую поддержку. Спасибо за понимание!"""
727 | markup.add(button1)
728 | markup.add(button2)
729 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
730 |
731 | elif message.text.lower() == f"/log@{botname}":
732 | markup = types.InlineKeyboardMarkup()
733 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
734 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
735 | markdown = f"""🚨 *ПРЕДУПРЕЖДЕНИЕ*: Пожалуйста, обратите внимание, что команда `/log@{botname}` доступна только в *личных сообщениях* с данным ботом. Использование этой команды в групповых чатах или каналах может вызвать непредвиденные ошибки и нарушения конфиденциальности.
736 |
737 | 🙏 Пожалуйста, следуйте этому правилу, чтобы избежать любых проблем. Если у вас есть какие-либо вопросы или проблемы, пожалуйста, обратитесь к нашей документации или напишите в техническую поддержку. Спасибо за понимание!"""
738 | markup.add(button1)
739 | markup.add(button2)
740 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
741 |
742 | @bot.message_handler(commands=['id'])
743 | def logsend(message):
744 | message_date = datetime.fromtimestamp(message.date, timezone(timebot))
745 | message_date_string = message_date.strftime('%Y-%m-%d %H:%M:%S')
746 | if message.chat.type == 'private':
747 | if len(admin_list) > 0 and str(message.from_user.id) in admin_list:
748 | markup = types.InlineKeyboardMarkup()
749 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
750 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
751 | markdown = f"*Ваш айди*: `{message.from_user.id}`\n*Айди чата*: `{message.chat.id}`\n*Ваш username*: `{message.from_user.username}`\n*Дата и время на сервере*: `{message_date_string}`\n*Являетесь ли вы Администратором*: `Да`"
752 | markup.add(button1)
753 | markup.add(button2)
754 | bot.send_message(message.chat.id, text=markdown, reply_markup=markup, parse_mode="Markdown")
755 | else:
756 | markup = types.InlineKeyboardMarkup()
757 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
758 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
759 | markdown = f"*Ваш айди*: `{message.from_user.id}`\n*Айди чата*: `{message.chat.id}`\n*Ваш username*: `{message.from_user.username}`\n*Дата и время на сервере*: `{message_date_string}`\n*Являетесь ли вы Администратором*: `Нет`"
760 | markup.add(button1)
761 | markup.add(button2)
762 | bot.send_message(message.chat.id, text=markdown, reply_markup=markup, parse_mode="Markdown")
763 | elif message.chat.type in ['group', 'supergroup']:
764 | if len(admin_list) > 0 and str(message.from_user.id) in admin_list:
765 | markup = types.InlineKeyboardMarkup()
766 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
767 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
768 | markdown = f"*Ваш айди*: `{message.from_user.id}`\n*Айди беседы*: `{message.chat.id}`\n*Ваш username*: `{message.from_user.username}`\n*Дата и время на сервере*: `{message_date_string}`\n*Являетесь ли вы Администратором*: `Да`"
769 | markup.add(button1)
770 | markup.add(button2)
771 | bot.send_message(message.chat.id, text=markdown, reply_markup=markup, parse_mode="Markdown")
772 | else:
773 | markup = types.InlineKeyboardMarkup()
774 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
775 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
776 | markdown = f"*Ваш айди*: `{message.from_user.id}`\n*Айди беседы*: `{message.chat.id}`\n*Ваш username*: `{message.from_user.username}`\n*Дата и время на сервере*: `{message_date_string}`\n*Являетесь ли вы Администратором*: `Нет`"
777 | markup.add(button1)
778 | markup.add(button2)
779 | bot.send_message(message.chat.id, text=markdown, reply_markup=markup, parse_mode="Markdown")
780 |
781 |
782 | @bot.message_handler(content_types=['voice'])
783 | def save_voice(message):
784 | if message.chat.type == 'private':
785 | if message.chat.id in last_whisper and time.time() - last_whisper[message.chat.id] < 30:
786 | markup = types.InlineKeyboardMarkup()
787 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
788 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguser")
789 | markdown = "🚫 *Слишком быстро! Пожалуйста, подождите 30 секунд перед отправкой нового сообщения.*"
790 | markup.add(button1)
791 | markup.add(button2)
792 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
793 | else:
794 |
795 | if message.voice.file_id in last_whisper:
796 | elapsed_time = time.time() - last_whisper[message.voice.file_id]
797 | if elapsed_time < 30:
798 | time.sleep(30 - elapsed_time)
799 |
800 | msg = bot.reply_to(message, "🔎 Идет загрузка, подождите...")
801 |
802 | last_whisper[message.chat.id] = time.time()
803 |
804 | file_info = bot.get_file(message.voice.file_id)
805 | file_path = file_info.file_path
806 |
807 | downloaded_file = bot.download_file(file_path)
808 |
809 | try:
810 | os.mkdir("voices")
811 | except:
812 | pass
813 |
814 | file_name = 'voice{}.ogg'.format(message.message_id)
815 | file_path = os.path.join('voices', file_name)
816 |
817 | with open(file_path, 'wb') as f:
818 | f.write(downloaded_file)
819 | f.close()
820 |
821 | try:
822 | sound = pydub.AudioSegment.from_file(f"voices/voice{message.message_id}.ogg", format="ogg")
823 | sound.export(f"voices/voice{message.message_id}.mp3", format="mp3")
824 |
825 | try:
826 | os.remove("voices/voicelove.mp3")
827 | except:
828 | pass
829 |
830 | one = f"voices/voice{message.message_id}.mp3"
831 | two = "voices/voicelove.mp3"
832 | shutil.copyfile(one, two)
833 | fileaudio = open("voices/voicelove.mp3", "rb")
834 | response = openai.Audio.transcribe("whisper-1", fileaudio)
835 | fileaudio.close()
836 |
837 | username = message.from_user.first_name
838 | bot.delete_message(message.chat.id, msg.message_id)
839 | bot.reply_to(message, text="✅ Ответ получен!")
840 | sendmsg = response["text"]
841 |
842 |
843 | if 'sendmsg' in locals():
844 | splitted_text = util.smart_split(sendmsg, chars_per_string=2000)
845 | for text in splitted_text:
846 | bot.send_message(message.chat.id, text=f"👨 *Запрос отправлен пользователем*: `{username}`\n\n🎈 *Айди сообщения*: `{message.message_id}`\n\n👾 *Ответ от Whisper*: {text}", parse_mode="Markdown")
847 |
848 |
849 | message_date = datetime.fromtimestamp(message.date, timezone(timebot))
850 | message_date_string = message_date.strftime('%Y-%m-%d %H:%M:%S')
851 |
852 | f = open("chatlog.txt", "a")
853 | f.writelines('---------------------------------------------------------------------------')
854 | f.writelines('\n')
855 | f.writelines('Model: Whisper')
856 | f.writelines('\n')
857 | f.writelines(f'ChatID: {message.chat.id}')
858 | f.writelines('\n')
859 | f.writelines(f'MessageID: {message.message_id}')
860 | f.writelines('\n')
861 | f.writelines(f'UserID: {message.from_user.id}')
862 | f.writelines('\n')
863 | f.writelines(f'Username: {message.from_user.username}')
864 | f.writelines('\n')
865 | f.writelines(f'Date and Time: {message_date_string}')
866 | f.writelines('\n')
867 | f.writelines(f'AI reply: {sendmsg}')
868 | f.writelines('\n')
869 | f.writelines('---------------------------------------------------------------------------')
870 | f.writelines('\n\n')
871 | f.close
872 |
873 | shutil.rmtree("voices")
874 |
875 | except openai.error.Timeout as e:
876 | shutil.rmtree("voices")
877 | print(e)
878 | bot.delete_message(message.chat.id, msg.message_id)
879 | markup = types.InlineKeyboardMarkup()
880 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
881 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
882 | markup.add(button1)
883 | markup.add(button2)
884 | markdown = f"❌ *OpenAI API не смог обработать запрос*: `{e}`"
885 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
886 |
887 | except openai.error.APIError as e:
888 | shutil.rmtree("voices")
889 | print(e)
890 | bot.delete_message(message.chat.id, msg.message_id)
891 | markup = types.InlineKeyboardMarkup()
892 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
893 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
894 | markup.add(button1)
895 | markup.add(button2)
896 | markdown = f"❌ *OpenAI API вернул ошибку API*: `{e}`"
897 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
898 |
899 | except openai.error.APIConnectionError as e:
900 | shutil.rmtree("voices")
901 | print(e)
902 | bot.delete_message(message.chat.id, msg.message_id)
903 | markup = types.InlineKeyboardMarkup()
904 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
905 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
906 | markup.add(button1)
907 | markup.add(button2)
908 | markdown = f"❌ *Невозможно подключиться к OpenAI API*: `{e}`"
909 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
910 |
911 | except openai.error.InvalidRequestError as e:
912 | shutil.rmtree("voices")
913 | print(e)
914 | bot.delete_message(message.chat.id, msg.message_id)
915 | markup = types.InlineKeyboardMarkup()
916 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
917 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
918 | markup.add(button1)
919 | markup.add(button2)
920 | markdown = f"❌ *OpenAI API запрос оказался недействительным*: `{e}`"
921 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
922 |
923 | except openai.error.AuthenticationError as e:
924 | shutil.rmtree("voices")
925 | print(e)
926 | bot.delete_message(message.chat.id, msg.message_id)
927 | markup = types.InlineKeyboardMarkup()
928 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
929 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
930 | markup.add(button1)
931 | markup.add(button2)
932 | markdown = f"❌ *OpenAI API запрос не был авторизован*: `{e}`"
933 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
934 |
935 | except openai.error.PermissionError as e:
936 | shutil.rmtree("voices")
937 | print(e)
938 | bot.delete_message(message.chat.id, msg.message_id)
939 | markup = types.InlineKeyboardMarkup()
940 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
941 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
942 | markup.add(button1)
943 | markup.add(button2)
944 | markdown = f"❌ *Запрос OpenAI API не был разрешен*: `{e}`"
945 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
946 |
947 | except openai.error.RateLimitError as e:
948 | shutil.rmtree("voices")
949 | print(e)
950 | bot.delete_message(message.chat.id, msg.message_id)
951 | markup = types.InlineKeyboardMarkup()
952 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
953 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
954 | markup.add(button1)
955 | markup.add(button2)
956 | markdown = f"❌ *Превышены лимиты OpenAI API*: `{e}`"
957 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
958 |
959 |
960 | elif message.chat.type in ['group', 'supergroup']:
961 | pass
962 |
963 | @bot.message_handler(content_types=['text'])
964 | def send_text(message):
965 | if message.chat.type != 'private':
966 | return
967 | if message.text.lower() == "🚀 мои проекты":
968 | markup = types.InlineKeyboardMarkup()
969 | button1 = types.InlineKeyboardButton("Группа VK", url="https://vk.com/chatgptcontent")
970 | button2 = types.InlineKeyboardButton("Telegram канал", url="https://t.me/hzfnews")
971 | markup.add(button1, button2)
972 | markdown = """*Подпишись на нашу группу ВК и Telegram канал 📢*
973 |
974 | Мы будем рады видеть вас в нашей группе ВКонтакте и канале в Telegram! 🔍 Там вы сможете узнать о наших новостях, анонсах и мероприятиях, а также общаться с другими пользователями. 💬
975 |
976 | Подпишитесь на оба канала, чтобы быть в курсе всех новостей и обновлений, связанных с данным ботом. 🤖
977 |
978 | Благодарим за использование нашего бота! 🙏"""
979 | bot.send_message(message.chat.id, markdown, reply_markup=markup, parse_mode="Markdown")
980 |
981 | elif message.text.lower() == "💰 поддержать автора монетой":
982 | markdown = """ *Поддержать автора монетой 💰*
983 |
984 | Если вам нравится использовать этот бот и вы хотите поддержать наш проект, мы будем очень благодарны за любую помощь.
985 |
986 | Вы можете сделать донат нашему проекту через следующие платежные системы:
987 |
988 | *QIWI*: [Нажми на меня](https://qiwi.com/n/AVENCORESDONATE) 💳
989 | *Сбер*: `2202 2050 7215 4401` 💵
990 | *ВТБ*: `2200 2404 1001 8580` 💶
991 |
992 | Ваша поддержка поможет нам продолжать развивать этот бот и добавлять новые функции. 🚀
993 |
994 | Благодарим за использование нашего бота и за вашу поддержку! 🙏"""
995 | bot.send_message(message.chat.id, markdown, parse_mode="Markdown")
996 |
997 | elif message.text.lower() == "🔧 техническая поддержка":
998 | markup = types.InlineKeyboardMarkup()
999 | button1 = types.InlineKeyboardButton("Я в VK", url="https://vk.com/avencores")
1000 | button2 = types.InlineKeyboardButton("Я в Telegram", url="https://t.me/avencores")
1001 | markup.add(button1, button2)
1002 | markdown = """*Техническая поддержка 🛠️*
1003 |
1004 | Если у вас возникли проблемы с использованием этого бота или у вас есть вопросы по поводу его функциональности, наша команда технической поддержки всегда готова помочь вам.
1005 |
1006 | Вы можете связаться с нами через наши страницы в социальных сетях, для этого просто нажмите на кнопки снизу. 👇
1007 |
1008 | Мы гарантируем быстрый и профессиональный ответ на все ваши запросы. 💬
1009 |
1010 | Благодарим за использование нашего бота! 🙏"""
1011 | bot.send_message(message.chat.id, markdown, reply_markup=markup, parse_mode="Markdown")
1012 |
1013 | elif message.text.lower() == "📈 статус бота":
1014 | url = "https://api.openai.com/dashboard/billing/credit_grants"
1015 | headers = {
1016 | "Content-Type": "application/json",
1017 | f"Authorization": f"Bearer {session_key}"
1018 | }
1019 |
1020 | response = requests.get(url, headers=headers)
1021 | data = response.json()
1022 | balance = data['total_used']
1023 | totalbalance = data['total_granted']
1024 | totalavailable = data['total_available']
1025 |
1026 | pyver = sys.version.split()[0]
1027 | current_time = time.time()
1028 | uptime = int(current_time - start_time)
1029 | uptime_str = f"{uptime // (24 * 3600)} день(-ней), {uptime // 3600 % 24} час(-ов), {uptime // 60 % 60} минут(-а), {uptime % 60} секунд(-а)"
1030 | markdown = datetime.now().strftime(f"""*Бот работает в штатном режиме.* 🤖\n
1031 | *Время на сервере*: `%H:%M:%S` ⏰
1032 | *Дата на сервере*: `%d.%m.%y` 📅
1033 |
1034 | *Общий баланс токена*: 💸`{totalbalance}`
1035 | *Использовано баланса токена*: 💸`{balance}`
1036 | *Осталось денег на балансе токена*: 💸`{totalavailable}`
1037 |
1038 | *Платформа на сервере*: `{platform}` 💻
1039 | *Версия Python на сервере*: `{pyver}` 🐍
1040 | *Аптайм бота*: `{uptime_str}` ⌛""")
1041 | bot.send_message(message.chat.id, markdown, parse_mode="Markdown")
1042 |
1043 | elif message.text.lower() == "📃 исходный код":
1044 | markup = types.InlineKeyboardMarkup()
1045 | button1 = types.InlineKeyboardButton("GitHub Page", url="https://github.com/AvenCores/openai-api-telegram-bot-public")
1046 | button2 = types.InlineKeyboardButton("Full GNU GPL V3", url="https://www.gnu.org/licenses/quick-guide-gplv3.ru.html")
1047 | markdown = """⚠️ *Предупреждение* ⚠️
1048 |
1049 | Данный телеграм бот распространяется под лицензией GNU GPL 3. Это означает, что вы имеете право свободно использовать, распространять и изменять исходный код этого бота, при условии, что все ваши изменения также будут распространяться под той же лицензией. 🆓
1050 |
1051 | Мы просим вас уважать авторские права и не использовать этот бот в незаконных целях. Если вы не согласны с условиями GNU GPL 3, пожалуйста, прекратите использование этого бота немедленно. ❌
1052 |
1053 | Спасибо за понимание и уважение к правам авторов! 🙏"""
1054 | markup.add(button1, button2)
1055 | bot.send_message(message.chat.id, markdown, reply_markup=markup, parse_mode="Markdown")
1056 |
1057 | elif message.text.lower() == "💬 мои чаты":
1058 | markup = types.InlineKeyboardMarkup()
1059 | button1 = types.InlineKeyboardButton("Telegram Chat", url="http://t.me/+cUZbC1ujWr9kZDky")
1060 | button2 = types.InlineKeyboardButton("VK Chat", url="https://vk.me/join/VqYKejk4a/QQvIXq6DhW6huxyAJ/A7cCiD4=")
1061 | markdown = """📣 *Присоединяйтесь к нашему Telegram и VK чату!* 🚀
1062 |
1063 | 👥 Здесь вы найдете единомышленников, с которыми сможете обсуждать интересные темы, делиться опытом и получать полезные советы.
1064 |
1065 | 💬 Общение с людьми, которые разделяют ваши интересы, может стать настоящей находкой! А еще у нас вы сможете научиться новым навыкам и расширить свой кругозор.
1066 |
1067 | 👉 Присоединяйтесь к нам прямо сейчас, чтобы не пропустить ни одного интересного обсуждения! 💻📱"""
1068 | markup.add(button1, button2)
1069 | bot.send_message(message.chat.id, markdown, reply_markup=markup, parse_mode="Markdown")
1070 |
1071 |
1072 | else:
1073 | markup = types.InlineKeyboardMarkup()
1074 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
1075 | button2 = types.InlineKeyboardButton("Скрыть уведомление и запрос", callback_data="delerrorandmsguser")
1076 | markdown = """❌ Ошибка! Команда не найдена 🤔
1077 |
1078 | Чтобы узнать, как использовать этот Telegram бот, отправьте сообщение /start 👉👀
1079 |
1080 | Это поможет вам ознакомиться со всеми доступными функциями и начать работу с ботом. Если у вас возникнут какие-либо вопросы, не стесняйтесь обращаться в техническая поддержку нашего Telegram бота 🤗
1081 |
1082 | Спасибо за ваше понимание! 🙏"""
1083 | markup.add(button1)
1084 | markup.add(button2)
1085 | bot.reply_to(message, text=markdown, reply_markup=markup, parse_mode="Markdown")
1086 |
1087 | @bot.callback_query_handler(func=lambda call: call.data == "dellthiserror")
1088 | def dellthiserror(call):
1089 | bot.answer_callback_query(callback_query_id=call.id, text="Уведомление скрыто")
1090 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
1091 |
1092 | @bot.callback_query_handler(func=lambda call: call.data == "delerrorandmsguser")
1093 | def delerrorandmsguser(call):
1094 | bot.answer_callback_query(callback_query_id=call.id, text="Уведомление скрыто")
1095 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
1096 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id - 1)
1097 |
1098 | @bot.callback_query_handler(func=lambda call: call.data == "delerrorandmsguserbot")
1099 | def delerrorandmsguserbot(call):
1100 | bot.answer_callback_query(callback_query_id=call.id, text="Уведомление скрыто")
1101 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
1102 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id - 2)
1103 |
1104 | @bot.callback_query_handler(func=lambda call: call.data == "yesdownload")
1105 | def yesdownload(call):
1106 | try:
1107 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
1108 | bot.answer_callback_query(callback_query_id=call.id, text="Логи были успешно отправлены")
1109 | with open('chatlog.txt', 'rb') as log_file:
1110 | bot.send_document(chat_id=call.message.chat.id, document=log_file, caption="📃 Это все логи, которые бот успел собрать на момент отправки.")
1111 | log_file.close()
1112 | os.remove("chatlog.txt")
1113 | except Exception as e:
1114 | print(e)
1115 | bot.delete_message(chat_id=call.message.chat.id, message_id=call.message.message_id)
1116 | markup = types.InlineKeyboardMarkup()
1117 | button1 = types.InlineKeyboardButton("Cкрыть уведомление", callback_data="dellthiserror")
1118 | button2 = types.InlineKeyboardButton("Скрыть уведомление и ваше сообщение", callback_data="delerrorandmsguserbot")
1119 | markup.add(button1)
1120 | markup.add(button2)
1121 | bot.send_message(chat_id=call.message.chat.id, text=f"❌ *Файл логов оказался пустым, что привело к ошибке*: {e}", reply_markup=markup, parse_mode="Markdown")
1122 |
1123 | bot.polling(none_stop=True)
1124 |
1125 |
1126 | while True:
1127 | try:
1128 | mainstarter()
1129 | except Exception as e:
1130 | print(e)
1131 | continue
1132 |
--------------------------------------------------------------------------------
/native-install.py:
--------------------------------------------------------------------------------
1 | from sys import executable, platform
2 | import subprocess
3 |
4 |
5 | if platform == "win32":
6 | subprocess.run([executable, "-m", "pip", "install", "-r", "requirements.txt"])
7 |
8 | if platform.startswith("linux"):
9 | subprocess.run([executable, "-m", "pip", "install", "-r", "requirements.txt"])
10 |
--------------------------------------------------------------------------------
/native-start.py:
--------------------------------------------------------------------------------
1 | from sys import platform, executable, argv
2 | import subprocess
3 |
4 |
5 | if platform == "win32":
6 | subprocess.run([executable, "main.py"] + argv[1:])
7 |
8 | if platform.startswith("linux"):
9 | subprocess.run([executable, "main.py"] + argv[1:])
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pyTelegramBotAPI
2 | requests
3 | openai
4 | pydub
5 | pytz
6 |
--------------------------------------------------------------------------------
/stickers/4354353454.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/4354353454.webp
--------------------------------------------------------------------------------
/stickers/54754745745.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/54754745745.webp
--------------------------------------------------------------------------------
/stickers/5568568568568.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/5568568568568.webp
--------------------------------------------------------------------------------
/stickers/568568658568.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/568568658568.webp
--------------------------------------------------------------------------------
/stickers/56868568568.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/56868568568.webp
--------------------------------------------------------------------------------
/stickers/65856865865.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/65856865865.webp
--------------------------------------------------------------------------------
/stickers/65865856856.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/65865856856.webp
--------------------------------------------------------------------------------
/stickers/658658658.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/658658658.webp
--------------------------------------------------------------------------------
/stickers/68658658658.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/68658658658.webp
--------------------------------------------------------------------------------
/stickers/745745745754.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/745745745754.webp
--------------------------------------------------------------------------------
/stickers/754745745.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/754745745.webp
--------------------------------------------------------------------------------
/stickers/dhfdhdfhf.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/dhfdhdfhf.webp
--------------------------------------------------------------------------------
/stickers/fgjgfjfgj.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/fgjgfjfgj.webp
--------------------------------------------------------------------------------
/stickers/fhfdhfdh.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/fhfdhfdh.webp
--------------------------------------------------------------------------------
/stickers/fjfgjurturt.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/fjfgjurturt.webp
--------------------------------------------------------------------------------
/stickers/fjgfjfgjgfj.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/fjgfjfgjgfj.webp
--------------------------------------------------------------------------------
/stickers/hdfhdfhdfh.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/hdfhdfhdfh.webp
--------------------------------------------------------------------------------
/stickers/jfgjturtur.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/jfgjturtur.webp
--------------------------------------------------------------------------------
/stickers/jfjfgjfgjg.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/jfjfgjfgjg.webp
--------------------------------------------------------------------------------
/stickers/rtutrurtjfgj.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/rtutrurtjfgj.webp
--------------------------------------------------------------------------------
/stickers/rtutrurtutru.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/rtutrurtutru.webp
--------------------------------------------------------------------------------
/stickers/rutrutrutrurt.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/rutrutrutrurt.webp
--------------------------------------------------------------------------------
/stickers/sticker-animenazi.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/sticker-animenazi.webp
--------------------------------------------------------------------------------
/stickers/sticker.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/sticker.webp
--------------------------------------------------------------------------------
/stickers/trutrutrur.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/trutrutrur.webp
--------------------------------------------------------------------------------
/stickers/urturturtutru.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/urturturtutru.webp
--------------------------------------------------------------------------------
/stickers/urturutrurt.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvenCores/openai-api-telegram-bot-public/622b45a28552578c0fcb14141b87f7b9e7234508/stickers/urturutrurt.webp
--------------------------------------------------------------------------------
/venv-install.py:
--------------------------------------------------------------------------------
1 | from sys import platform
2 | import subprocess
3 | import os
4 |
5 |
6 | activate_script_windows = os.path.join("venv", "Scripts", "activate")
7 | activate_script_linux = os.path.join("venv", "bin", "activate")
8 |
9 | if not os.path.isdir("venv"):
10 | subprocess.run(["python", "-m", "venv", "venv"])
11 |
12 | if platform == "win32":
13 | subprocess.run([f"cmd /c {activate_script_windows} && pip install -r requirements.txt"], shell=True)
14 |
15 | if platform.startswith("linux"):
16 | subprocess.run([f"source {activate_script_linux} && pip3 install -r requirements.txt"], shell=True)
17 |
--------------------------------------------------------------------------------
/venv-start.py:
--------------------------------------------------------------------------------
1 | from sys import platform
2 | import subprocess
3 | import os
4 |
5 |
6 | activate_script_windows = os.path.join("venv", "Scripts", "activate")
7 | activate_script_linux = os.path.join("venv", "bin", "activate")
8 |
9 | if platform == "win32":
10 | subprocess.run([f"cmd /c {activate_script_windows} && python main.py"], shell=True)
11 |
12 | if platform.startswith("linux"):
13 | subprocess.run([f"source {activate_script_linux} && python3 main.py"], shell=True)
--------------------------------------------------------------------------------