forked from Den4ikSuperOstryyPer4ik/Astro-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandomTrack.py
159 lines (141 loc) · 7.09 KB
/
RandomTrack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
__version__ = (1, 4, 2)
# _ __ __ _ _
# /\ | | | \/ | | | | |
# / \ ___| |_ _ __ ___ | \ / | ___ __| |_ _| | ___ ___
# / /\ \ / __| __| '__/ _ \| |\/| |/ _ \ / _` | | | | |/ _ \/ __|
# / ____ \\__ \ |_| | | (_) | | | | (_) | (_| | |_| | | __/\__ \
# /_/ \_\___/\__|_| \___/|_| |_|\___/ \__,_|\__,_|_|\___||___/
#
# © Copyright 2022
#
# https://t.me/Den4ikSuperOstryyPer4ik
# and
# https://t.me/ToXicUse
#
# 🔒 Licensed under the GNU AGPLv3
# https://www.gnu.org/licenses/agpl-3.0.html
#
# meta developer: @AstroModules
from .. import loader, utils
import random
from telethon.tl.types import Message, InputMessagesFilterMusic
@loader.tds
class RandomTrackMod(loader.Module):
"""Получить рандомный трек.
Используйте категории чтобы сгенерировать трек на свой вкус."""
strings = {"name": "RandomTrack"}
def __init__(self):
self.config = loader.ModuleConfig(
loader.ConfigValue(
"playlist",
None,
doc=lambda: "Введите юзер своего канала с музыкой",
),
loader.ConfigValue(
"fonks",
"AM_fonks",
doc=lambda: "Введите юзер своего канала с фонками",
),
loader.ConfigValue(
"remixes",
"AM_rmx",
doc=lambda: "Введите юзер своего канала с ремиксами",
),
loader.ConfigValue(
"sad",
"AM_depressive",
doc=lambda: "Введите юзер своего канала с грустной музыкой",
),
loader.ConfigValue(
"popular",
"AM_popular",
doc=lambda: "Введите юзер своего канала с поп музыкой",
),
loader.ConfigValue(
"hyperpop",
"hyperpopmusicx_x",
doc=lambda: "Введите юзер своего канала с хайперпоп музыкой",
),
loader.ConfigValue(
"mems",
"AM_memss",
doc=lambda: "Введите юзер своего канала с мемами",
)
)
@loader.command()
async def rt(self, message: Message):
"""- сгенерировать трек.
🫠 Категории:
<f> - фонки
<r> - ремиксы
<m> - мемные звуки
<s> - грустная музыка
<h> - хайперпоп музыка
<p> - популярная музыка
<n> - ностальгические треки
<my> - треки из вашего плейлиста
🤫 По желанию, в конфиге, можно указать свои каналы откуда будет отбираться музыка"""
args = utils.get_args_raw(message)
afonks = self.config['fonks']
asad = self.config['sad']
ahpop = self.config['hyperpop']
armx = self.config['remixes']
apop = self.config['popular']
amems = self.config['mems']
aplaylist = self.config['playlist']
agroup = "shyshomuz"
nstt = 'AM_NSTL'
if not args:
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем трек...</b>")
music = random.choice([msg async for msg in self.client.iter_messages(agroup, limit=1000, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=music)
if message.out:
await message.delete()
if args == "f":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем фонк...</b>")
fonk = random.choice([msg async for msg in self.client.iter_messages(afonks, limit=100, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=fonk)
if message.out:
await message.delete()
if args == "s":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем грустный трек...</b>")
depr = random.choice([msg async for msg in self.client.iter_messages(asad, limit=100, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=depr)
if message.out:
await message.delete()
if args == "h":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем хайперпоп...</b>")
hyper = random.choice([msg async for msg in self.client.iter_messages(ahpop, limit=100, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=hyper)
if message.out:
await message.delete()
if args == "r":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем ремикс...</b>")
remix = random.choice([msg async for msg in self.client.iter_messages(armx, limit=100, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=remix)
if message.out:
await message.delete()
if args == "m":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем трек...</b>")
mem = random.choice(await self.client.get_messages(amems, limit=100, reply_to=utils.get_topic(message)))
await message.respond(file=mem)
if message.out:
await message.delete()
if args == "p":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем трек...</b>")
pop = random.choice([msg async for msg in self.client.iter_messages(apop, limit=100, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=pop)
if message.out:
await message.delete()
if args == "n":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем трек...</b>")
nst = random.choice([msg async for msg in self.client.iter_messages(nstt, limit=200, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=nst)
if message.out:
await message.delete()
if args == "my":
await utils.answer(message, "<emoji document_id=5219806684066618617>🫠</emoji> <b>Подбираем трек с вашего плейлиста...</b>")
my = random.choice([msg async for msg in self.client.iter_messages(aplaylist, limit=100, filter=InputMessagesFilterMusic, reply_to=utils.get_topic(message))])
await message.respond(file=my)
if message.out:
await message.delete()