-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_DM
executable file
·45 lines (37 loc) · 995 Bytes
/
delete_DM
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
#!/bin/bash
SPEED=0.1
echo "How many messages do you want to remove?"
read numMsgs
until [[ $activeWindow == *"Discord"* ]]; do
sleep 1
activeWindow="$(xdotool getactivewindow getwindowname)"
done
windowID="$(xdotool getactivewindow)"
channelName="$(echo $activeWindow | cut -d' ' -f1)"
echo "Removing your DM history on the $channelName channel ..."
counter=0
for ((i=0; i<numMsgs; i++)); do
xdotool key Return
sleep $SPEED
xdotool key Up
sleep $SPEED
xdotool key ctrl+a
sleep $SPEED
xdotool key BackSpace
sleep $SPEED
xdotool key Return
sleep $SPEED
xdotool key Return
sleep $SPEED
xdotool key Page_Up
sleep $SPEED
xdotool key BackSpace
sleep $SPEED
if [[ "$(xdotool getactivewindow getwindowname)" != *"Discord"* ]]; then
echo "Process interupted!"
break
fi
let "counter+=1"
echo -ne "Progress: $counter messages removed sofar\r"
done
echo -e "\nDone. $counter messages removed"