@@ -75,8 +75,8 @@ async def cancel_multi(_, query):
75
75
await delete_message (query .message )
76
76
77
77
78
- async def cancel_all (status , userId ):
79
- matches = await get_all_tasks (status .strip (), userId )
78
+ async def cancel_all (status , user_id ):
79
+ matches = await get_all_tasks (status .strip (), user_id )
80
80
if not matches :
81
81
return False
82
82
for task in matches :
@@ -86,41 +86,45 @@ async def cancel_all(status, userId):
86
86
return True
87
87
88
88
89
- def create_cancel_buttons (isSudo , userId = "" ):
89
+ def create_cancel_buttons (is_sudo , user_id = "" ):
90
90
buttons = button_build .ButtonMaker ()
91
91
buttons .data_button (
92
- "Downloading" , f"canall ms { MirrorStatus .STATUS_DOWNLOADING } { userId } "
92
+ "Downloading" , f"canall ms { MirrorStatus .STATUS_DOWNLOADING } { user_id } "
93
93
)
94
94
buttons .data_button (
95
- "Uploading" , f"canall ms { MirrorStatus .STATUS_UPLOADING } { userId } "
95
+ "Uploading" , f"canall ms { MirrorStatus .STATUS_UPLOADING } { user_id } "
96
96
)
97
- buttons .data_button ("Seeding" , f"canall ms { MirrorStatus .STATUS_SEEDING } { userId } " )
97
+ buttons .data_button ("Seeding" , f"canall ms { MirrorStatus .STATUS_SEEDING } { user_id } " )
98
98
buttons .data_button (
99
- "Spltting" , f"canall ms { MirrorStatus .STATUS_SPLITTING } { userId } "
99
+ "Spltting" , f"canall ms { MirrorStatus .STATUS_SPLITTING } { user_id } "
100
100
)
101
- buttons .data_button ("Cloning" , f"canall ms { MirrorStatus .STATUS_CLONING } { userId } " )
101
+ buttons .data_button ("Cloning" , f"canall ms { MirrorStatus .STATUS_CLONING } { user_id } " )
102
102
buttons .data_button (
103
- "Extracting" , f"canall ms { MirrorStatus .STATUS_EXTRACTING } { userId } "
103
+ "Extracting" , f"canall ms { MirrorStatus .STATUS_EXTRACTING } { user_id } "
104
104
)
105
105
buttons .data_button (
106
- "Archiving" , f"canall ms { MirrorStatus .STATUS_ARCHIVING } { userId } "
106
+ "Archiving" , f"canall ms { MirrorStatus .STATUS_ARCHIVING } { user_id } "
107
107
)
108
- buttons .data_button ("QueuedDl" , f"canall ms { MirrorStatus .STATUS_QUEUEDL } { userId } " )
109
- buttons .data_button ("QueuedUp" , f"canall ms { MirrorStatus .STATUS_QUEUEUP } { userId } " )
110
108
buttons .data_button (
111
- "SampleVideo " , f"canall ms { MirrorStatus .STATUS_SAMVID } { userId } "
109
+ "QueuedDl " , f"canall ms { MirrorStatus .STATUS_QUEUEDL } { user_id } "
112
110
)
113
111
buttons .data_button (
114
- "ConvertMedia " , f"canall ms { MirrorStatus .STATUS_CONVERTING } { userId } "
112
+ "QueuedUp " , f"canall ms { MirrorStatus .STATUS_QUEUEUP } { user_id } "
115
113
)
116
- buttons .data_button ("Paused" , f"canall ms { MirrorStatus .STATUS_PAUSED } { userId } " )
117
- buttons .data_button ("All" , f"canall ms All { userId } " )
118
- if isSudo :
119
- if userId :
120
- buttons .data_button ("All Added Tasks" , f"canall bot ms { userId } " )
114
+ buttons .data_button (
115
+ "SampleVideo" , f"canall ms { MirrorStatus .STATUS_SAMVID } { user_id } "
116
+ )
117
+ buttons .data_button (
118
+ "ConvertMedia" , f"canall ms { MirrorStatus .STATUS_CONVERTING } { user_id } "
119
+ )
120
+ buttons .data_button ("Paused" , f"canall ms { MirrorStatus .STATUS_PAUSED } { user_id } " )
121
+ buttons .data_button ("All" , f"canall ms All { user_id } " )
122
+ if is_sudo :
123
+ if user_id :
124
+ buttons .data_button ("All Added Tasks" , f"canall bot ms { user_id } " )
121
125
else :
122
- buttons .data_button ("My Tasks" , f"canall user ms { userId } " )
123
- buttons .data_button ("Close" , f"canall close ms { userId } " )
126
+ buttons .data_button ("My Tasks" , f"canall user ms { user_id } " )
127
+ buttons .data_button ("Close" , f"canall close ms { user_id } " )
124
128
return buttons .build_menu (2 )
125
129
126
130
@@ -131,8 +135,8 @@ async def cancell_all_buttons(_, message):
131
135
if count == 0 :
132
136
await send_message (message , "No active tasks!" )
133
137
return
134
- isSudo = await CustomFilters .sudo ("" , message )
135
- button = create_cancel_buttons (isSudo , message .from_user .id )
138
+ is_sudo = await CustomFilters .sudo ("" , message )
139
+ button = create_cancel_buttons (is_sudo , message .from_user .id )
136
140
can_msg = await send_message (message , "Choose tasks to cancel!" , button )
137
141
await auto_delete_message (message , can_msg )
138
142
@@ -142,37 +146,37 @@ async def cancel_all_update(_, query):
142
146
data = query .data .split ()
143
147
message = query .message
144
148
reply_to = message .reply_to_message
145
- userId = int (data [3 ]) if len (data ) > 3 else ""
146
- isSudo = await CustomFilters .sudo ("" , query )
147
- if not isSudo and userId and userId != query .from_user .id :
149
+ user_id = int (data [3 ]) if len (data ) > 3 else ""
150
+ is_sudo = await CustomFilters .sudo ("" , query )
151
+ if not is_sudo and user_id and user_id != query .from_user .id :
148
152
await query .answer ("Not Yours!" , show_alert = True )
149
153
else :
150
154
await query .answer ()
151
155
if data [1 ] == "close" :
152
156
await delete_message (reply_to )
153
157
await delete_message (message )
154
158
elif data [1 ] == "back" :
155
- button = create_cancel_buttons (isSudo , userId )
159
+ button = create_cancel_buttons (is_sudo , user_id )
156
160
await edit_message (message , "Choose tasks to cancel!" , button )
157
161
elif data [1 ] == "bot" :
158
- button = create_cancel_buttons (isSudo , "" )
162
+ button = create_cancel_buttons (is_sudo , "" )
159
163
await edit_message (message , "Choose tasks to cancel!" , button )
160
164
elif data [1 ] == "user" :
161
- button = create_cancel_buttons (isSudo , query .from_user .id )
165
+ button = create_cancel_buttons (is_sudo , query .from_user .id )
162
166
await edit_message (message , "Choose tasks to cancel!" , button )
163
167
elif data [1 ] == "ms" :
164
168
buttons = button_build .ButtonMaker ()
165
- buttons .data_button ("Yes!" , f"canall { data [2 ]} confirm { userId } " )
166
- buttons .data_button ("Back" , f"canall back confirm { userId } " )
167
- buttons .data_button ("Close" , f"canall close confirm { userId } " )
169
+ buttons .data_button ("Yes!" , f"canall { data [2 ]} confirm { user_id } " )
170
+ buttons .data_button ("Back" , f"canall back confirm { user_id } " )
171
+ buttons .data_button ("Close" , f"canall close confirm { user_id } " )
168
172
button = buttons .build_menu (2 )
169
173
await edit_message (
170
174
message , f"Are you sure you want to cancel all { data [2 ]} tasks" , button
171
175
)
172
176
else :
173
- button = create_cancel_buttons (isSudo , userId )
177
+ button = create_cancel_buttons (is_sudo , user_id )
174
178
await edit_message (message , "Choose tasks to cancel." , button )
175
- res = await cancel_all (data [1 ], userId )
179
+ res = await cancel_all (data [1 ], user_id )
176
180
if not res :
177
181
await send_message (reply_to , f"No matching tasks for { data [1 ]} !" )
178
182
0 commit comments