Add files via upload
59
README.md
|
@ -1,2 +1,57 @@
|
|||
# kickme
|
||||
line
|
||||
# BotAlphatJS
|
||||
Bot Kicker And Bot Anti Kicker, Check Sider.
|
||||
------
|
||||
-
|
||||
|
||||
Cara Install Bot AlphatJS :
|
||||
------
|
||||
- `pkg install nodejs -y`
|
||||
- `pkg install git -y`
|
||||
- `git clone https://github.com/Nadyatjia/BotAlphatJS`
|
||||
- `pkg install nano`
|
||||
- `cd AlphatJS`
|
||||
- `npm install`
|
||||
- `npm start`
|
||||
|
||||
Cara Menjalankan Bot Kembali :
|
||||
------
|
||||
- `cd AlphatJS`
|
||||
- `npm start`
|
||||
|
||||
Command "Help" :
|
||||
------
|
||||
🎶 Keyword Khusus Admin 🎶
|
||||
- `[Kick On/Off] = On/Off Mode Kick`
|
||||
- `[Kickall] = Mengekick Semua Member`
|
||||
- `[Info kick] = Cara Menggunakan Fitur Kickall`
|
||||
- `[Cancel On/Off] = On/Off Mode Cancel`
|
||||
- `[Cancelall] = Membatalkan Semua Invite'an`
|
||||
- `[Qrp On/Off]= On/Off Link Group`
|
||||
|
||||
🎶 Keyword Dalam Group 🎶
|
||||
- `[Chucky keluar] = Mengusir Bot Dari Group`
|
||||
- `[Status] = Menampilkan Info Kick&Cancel`
|
||||
- `[Speed] = Ngetest Respons Bot`
|
||||
- `[Left NamaGroup] = Bot Keluar Dari Group`
|
||||
- `[Setpoint/Set] = Untuk Memulai Sider`
|
||||
- `[Recheck/Check] = Melihat List Yang Sider`
|
||||
- `[Clear/Reset] = Untuk Hapus List Sider`
|
||||
- `[Myid] = Untuk Mengetahui MID`
|
||||
- `[Ig Ursname Kamu] = Info Instagram Kamu`
|
||||
- `[Qr Open/Close] = Buka/Tutup Link Group`
|
||||
- `[spam (S Huruf Kecil)] = Bot Akan Spam`
|
||||
- `[List admin] = Melihat Daftar Admin`
|
||||
- `[Tag all] = Mengetag Semua Member`
|
||||
- `[Creator] = Owner Pembuat Bot`
|
||||
- `[Gift] = Sent Sticker`
|
||||
|
||||
Credit By@ Nadya Sutjiadi.
|
||||
------
|
||||
- `Follow My Instagram : nadya.tjia`
|
||||
- `Add My ID LINE : nad_nad. (pake titik)`
|
||||
|
||||
Thx To :
|
||||
------
|
||||
- `Alfatdirk And LINE-TCR TEAM`
|
||||
|
||||
|
||||
|
|
1
b.git/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
ref: refs/heads/master
|
11
b.git/config
Normal file
|
@ -0,0 +1,11 @@
|
|||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[remote "origin"]
|
||||
url = https://github.com/alfathdirk/LineAlphatJS.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
[branch "master"]
|
||||
remote = origin
|
||||
merge = refs/heads/master
|
1
b.git/description
Normal file
|
@ -0,0 +1 @@
|
|||
Unnamed repository; edit this file 'description' to name the repository.
|
15
b.git/hooks/applypatch-msg.sample
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message taken by
|
||||
# applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit. The hook is
|
||||
# allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "applypatch-msg".
|
||||
|
||||
. git-sh-setup
|
||||
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
|
||||
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
|
||||
:
|
24
b.git/hooks/commit-msg.sample
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message.
|
||||
# Called by "git commit" with one argument, the name of the file
|
||||
# that has the commit message. The hook should exit with non-zero
|
||||
# status after issuing an appropriate message if it wants to stop the
|
||||
# commit. The hook is allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "commit-msg".
|
||||
|
||||
# Uncomment the below to add a Signed-off-by line to the message.
|
||||
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||
# hook is more suited to it.
|
||||
#
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||
|
||||
# This example catches duplicate Signed-off-by lines.
|
||||
|
||||
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||
echo >&2 Duplicate Signed-off-by lines.
|
||||
exit 1
|
||||
}
|
8
b.git/hooks/post-update.sample
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to prepare a packed repository for use over
|
||||
# dumb transports.
|
||||
#
|
||||
# To enable this hook, rename this file to "post-update".
|
||||
|
||||
exec git update-server-info
|
14
b.git/hooks/pre-applypatch.sample
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed
|
||||
# by applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-applypatch".
|
||||
|
||||
. git-sh-setup
|
||||
precommit="$(git rev-parse --git-path hooks/pre-commit)"
|
||||
test -x "$precommit" && exec "$precommit" ${1+"$@"}
|
||||
:
|
49
b.git/hooks/pre-commit.sample
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-commit".
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||
then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
fi
|
||||
|
||||
# If you want to allow non-ASCII filenames set this variable to true.
|
||||
allownonascii=$(git config --bool hooks.allownonascii)
|
||||
|
||||
# Redirect output to stderr.
|
||||
exec 1>&2
|
||||
|
||||
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
||||
# them from being added to the repository. We exploit the fact that the
|
||||
# printable range starts at the space character and ends with tilde.
|
||||
if [ "$allownonascii" != "true" ] &&
|
||||
# Note that the use of brackets around a tr range is ok here, (it's
|
||||
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
||||
# the square bracket bytes happen to fall in the designated range.
|
||||
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
||||
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||
then
|
||||
cat <<\EOF
|
||||
Error: Attempt to add a non-ASCII file name.
|
||||
|
||||
This can cause problems if you want to work with people on other platforms.
|
||||
|
||||
To be portable it is advisable to rename the file.
|
||||
|
||||
If you know what you are doing you can disable this check using:
|
||||
|
||||
git config hooks.allownonascii true
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If there are whitespace errors, print the offending file names and fail.
|
||||
exec git diff-index --check --cached $against --
|
53
b.git/hooks/pre-push.sample
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
|
||||
# An example hook script to verify what is about to be pushed. Called by "git
|
||||
# push" after it has checked the remote status, but before anything has been
|
||||
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||
#
|
||||
# This sample shows how to prevent push of commits where the log message starts
|
||||
# with "WIP" (work in progress).
|
||||
|
||||
remote="$1"
|
||||
url="$2"
|
||||
|
||||
z40=0000000000000000000000000000000000000000
|
||||
|
||||
while read local_ref local_sha remote_ref remote_sha
|
||||
do
|
||||
if [ "$local_sha" = $z40 ]
|
||||
then
|
||||
# Handle delete
|
||||
:
|
||||
else
|
||||
if [ "$remote_sha" = $z40 ]
|
||||
then
|
||||
# New branch, examine all commits
|
||||
range="$local_sha"
|
||||
else
|
||||
# Update to existing branch, examine new commits
|
||||
range="$remote_sha..$local_sha"
|
||||
fi
|
||||
|
||||
# Check for WIP commit
|
||||
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
|
||||
if [ -n "$commit" ]
|
||||
then
|
||||
echo >&2 "Found WIP commit in $local_ref, not pushing"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
169
b.git/hooks/pre-rebase.sample
Normal file
|
@ -0,0 +1,169 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
||||
#
|
||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
||||
# its job, and can prevent the command from running by exiting with
|
||||
# non-zero status.
|
||||
#
|
||||
# The hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- the upstream the series was forked from.
|
||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
||||
#
|
||||
# This sample shows how to prevent topic branches that are already
|
||||
# merged to 'next' branch from getting rebased, because allowing it
|
||||
# would result in rebasing already published history.
|
||||
|
||||
publish=next
|
||||
basebranch="$1"
|
||||
if test "$#" = 2
|
||||
then
|
||||
topic="refs/heads/$2"
|
||||
else
|
||||
topic=`git symbolic-ref HEAD` ||
|
||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
||||
fi
|
||||
|
||||
case "$topic" in
|
||||
refs/heads/??/*)
|
||||
;;
|
||||
*)
|
||||
exit 0 ;# we do not interrupt others.
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now we are dealing with a topic branch being rebased
|
||||
# on top of master. Is it OK to rebase it?
|
||||
|
||||
# Does the topic really exist?
|
||||
git show-ref -q "$topic" || {
|
||||
echo >&2 "No such branch $topic"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is topic fully merged to master?
|
||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
||||
if test -z "$not_in_master"
|
||||
then
|
||||
echo >&2 "$topic is fully merged to master; better remove it."
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
fi
|
||||
|
||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
||||
if test "$only_next_1" = "$only_next_2"
|
||||
then
|
||||
not_in_topic=`git rev-list "^$topic" master`
|
||||
if test -z "$not_in_topic"
|
||||
then
|
||||
echo >&2 "$topic is already up-to-date with master"
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
||||
/data/data/com.termux/files/usr/bin/perl -e '
|
||||
my $topic = $ARGV[0];
|
||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
||||
my (%not_in_next) = map {
|
||||
/^([0-9a-f]+) /;
|
||||
($1 => 1);
|
||||
} split(/\n/, $ARGV[1]);
|
||||
for my $elem (map {
|
||||
/^([0-9a-f]+) (.*)$/;
|
||||
[$1 => $2];
|
||||
} split(/\n/, $ARGV[2])) {
|
||||
if (!exists $not_in_next{$elem->[0]}) {
|
||||
if ($msg) {
|
||||
print STDERR $msg;
|
||||
undef $msg;
|
||||
}
|
||||
print STDERR " $elem->[1]\n";
|
||||
}
|
||||
}
|
||||
' "$topic" "$not_in_next" "$not_in_master"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
<<\DOC_END
|
||||
|
||||
This sample hook safeguards topic branches that have been
|
||||
published from being rewound.
|
||||
|
||||
The workflow assumed here is:
|
||||
|
||||
* Once a topic branch forks from "master", "master" is never
|
||||
merged into it again (either directly or indirectly).
|
||||
|
||||
* Once a topic branch is fully cooked and merged into "master",
|
||||
it is deleted. If you need to build on top of it to correct
|
||||
earlier mistakes, a new topic branch is created by forking at
|
||||
the tip of the "master". This is not strictly necessary, but
|
||||
it makes it easier to keep your history simple.
|
||||
|
||||
* Whenever you need to test or publish your changes to topic
|
||||
branches, merge them into "next" branch.
|
||||
|
||||
The script, being an example, hardcodes the publish branch name
|
||||
to be "next", but it is trivial to make it configurable via
|
||||
$GIT_DIR/config mechanism.
|
||||
|
||||
With this workflow, you would want to know:
|
||||
|
||||
(1) ... if a topic branch has ever been merged to "next". Young
|
||||
topic branches can have stupid mistakes you would rather
|
||||
clean up before publishing, and things that have not been
|
||||
merged into other branches can be easily rebased without
|
||||
affecting other people. But once it is published, you would
|
||||
not want to rewind it.
|
||||
|
||||
(2) ... if a topic branch has been fully merged to "master".
|
||||
Then you can delete it. More importantly, you should not
|
||||
build on top of it -- other people may already want to
|
||||
change things related to the topic as patches against your
|
||||
"master", so if you need further changes, it is better to
|
||||
fork the topic (perhaps with the same name) afresh from the
|
||||
tip of "master".
|
||||
|
||||
Let's look at this example:
|
||||
|
||||
o---o---o---o---o---o---o---o---o---o "next"
|
||||
/ / / /
|
||||
/ a---a---b A / /
|
||||
/ / / /
|
||||
/ / c---c---c---c B /
|
||||
/ / / \ /
|
||||
/ / / b---b C \ /
|
||||
/ / / / \ /
|
||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
||||
|
||||
|
||||
A, B and C are topic branches.
|
||||
|
||||
* A has one fix since it was merged up to "next".
|
||||
|
||||
* B has finished. It has been fully merged up to "master" and "next",
|
||||
and is ready to be deleted.
|
||||
|
||||
* C has not merged to "next" at all.
|
||||
|
||||
We would want to allow C to be rebased, refuse A, and encourage
|
||||
B to be deleted.
|
||||
|
||||
To compute (1):
|
||||
|
||||
git rev-list ^master ^topic next
|
||||
git rev-list ^master next
|
||||
|
||||
if these match, topic has not merged in next at all.
|
||||
|
||||
To compute (2):
|
||||
|
||||
git rev-list master..topic
|
||||
|
||||
if this is empty, it is fully merged to "master".
|
||||
|
||||
DOC_END
|
24
b.git/hooks/pre-receive.sample
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to make use of push options.
|
||||
# The example simply echoes all push options that start with 'echoback='
|
||||
# and rejects all pushes when the "reject" push option is used.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-receive".
|
||||
|
||||
if test -n "$GIT_PUSH_OPTION_COUNT"
|
||||
then
|
||||
i=0
|
||||
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
||||
do
|
||||
eval "value=\$GIT_PUSH_OPTION_$i"
|
||||
case "$value" in
|
||||
echoback=*)
|
||||
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
||||
;;
|
||||
reject)
|
||||
exit 1
|
||||
esac
|
||||
i=$((i + 1))
|
||||
done
|
||||
fi
|
36
b.git/hooks/prepare-commit-msg.sample
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to prepare the commit log message.
|
||||
# Called by "git commit" with the name of the file that has the
|
||||
# commit message, followed by the description of the commit
|
||||
# message's source. The hook's purpose is to edit the commit
|
||||
# message file. If the hook fails with a non-zero status,
|
||||
# the commit is aborted.
|
||||
#
|
||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
||||
|
||||
# This hook includes three examples. The first comments out the
|
||||
# "Conflicts:" part of a merge commit.
|
||||
#
|
||||
# The second includes the output of "git diff --name-status -r"
|
||||
# into the message, just before the "git status" output. It is
|
||||
# commented because it doesn't cope with --amend or with squashed
|
||||
# commits.
|
||||
#
|
||||
# The third example adds a Signed-off-by line to the message, that can
|
||||
# still be edited. This is rarely a good idea.
|
||||
|
||||
case "$2,$3" in
|
||||
merge,)
|
||||
/data/data/com.termux/files/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
||||
|
||||
# ,|template,)
|
||||
# /data/data/com.termux/files/usr/bin/perl -i.bak -pe '
|
||||
# print "\n" . `git diff --cached --name-status -r`
|
||||
# if /^#/ && $first++ == 0' "$1" ;;
|
||||
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
128
b.git/hooks/update.sample
Normal file
|
@ -0,0 +1,128 @@
|
|||
#!/data/data/com.termux/files/usr/bin/sh
|
||||
#
|
||||
# An example hook script to block unannotated tags from entering.
|
||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
||||
#
|
||||
# To enable this hook, rename this file to "update".
|
||||
#
|
||||
# Config
|
||||
# ------
|
||||
# hooks.allowunannotated
|
||||
# This boolean sets whether unannotated tags will be allowed into the
|
||||
# repository. By default they won't be.
|
||||
# hooks.allowdeletetag
|
||||
# This boolean sets whether deleting tags will be allowed in the
|
||||
# repository. By default they won't be.
|
||||
# hooks.allowmodifytag
|
||||
# This boolean sets whether a tag may be modified after creation. By default
|
||||
# it won't be.
|
||||
# hooks.allowdeletebranch
|
||||
# This boolean sets whether deleting branches will be allowed in the
|
||||
# repository. By default they won't be.
|
||||
# hooks.denycreatebranch
|
||||
# This boolean sets whether remotely creating branches will be denied
|
||||
# in the repository. By default this is allowed.
|
||||
#
|
||||
|
||||
# --- Command line
|
||||
refname="$1"
|
||||
oldrev="$2"
|
||||
newrev="$3"
|
||||
|
||||
# --- Safety check
|
||||
if [ -z "$GIT_DIR" ]; then
|
||||
echo "Don't run this script from the command line." >&2
|
||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Config
|
||||
allowunannotated=$(git config --bool hooks.allowunannotated)
|
||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
||||
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
||||
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
||||
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
||||
|
||||
# check for no description
|
||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
||||
case "$projectdesc" in
|
||||
"Unnamed repository"* | "")
|
||||
echo "*** Project description file hasn't been set" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Check types
|
||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
||||
zero="0000000000000000000000000000000000000000"
|
||||
if [ "$newrev" = "$zero" ]; then
|
||||
newrev_type=delete
|
||||
else
|
||||
newrev_type=$(git cat-file -t $newrev)
|
||||
fi
|
||||
|
||||
case "$refname","$newrev_type" in
|
||||
refs/tags/*,commit)
|
||||
# un-annotated tag
|
||||
short_refname=${refname##refs/tags/}
|
||||
if [ "$allowunannotated" != "true" ]; then
|
||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/tags/*,delete)
|
||||
# delete tag
|
||||
if [ "$allowdeletetag" != "true" ]; then
|
||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/tags/*,tag)
|
||||
# annotated tag
|
||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
||||
then
|
||||
echo "*** Tag '$refname' already exists." >&2
|
||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/heads/*,commit)
|
||||
# branch
|
||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/heads/*,delete)
|
||||
# delete branch
|
||||
if [ "$allowdeletebranch" != "true" ]; then
|
||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/remotes/*,commit)
|
||||
# tracking branch
|
||||
;;
|
||||
refs/remotes/*,delete)
|
||||
# delete tracking branch
|
||||
if [ "$allowdeletebranch" != "true" ]; then
|
||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Anything else (is there anything else?)
|
||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Finished
|
||||
exit 0
|
BIN
b.git/index
Normal file
6
b.git/info/exclude
Normal file
|
@ -0,0 +1,6 @@
|
|||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
1
b.git/logs/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
0000000000000000000000000000000000000000 2640e4888b6dda45b2e9bc502a139e964fb1be84 u0_a157 <u0_a157@localhost.(none)> 1509263777 +0700 clone: from https://github.com/alfathdirk/LineAlphatJS.git
|
1
b.git/logs/refs/heads/master
Normal file
|
@ -0,0 +1 @@
|
|||
0000000000000000000000000000000000000000 2640e4888b6dda45b2e9bc502a139e964fb1be84 u0_a157 <u0_a157@localhost.(none)> 1509263777 +0700 clone: from https://github.com/alfathdirk/LineAlphatJS.git
|
1
b.git/logs/refs/remotes/origin/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
0000000000000000000000000000000000000000 2640e4888b6dda45b2e9bc502a139e964fb1be84 u0_a157 <u0_a157@localhost.(none)> 1509263777 +0700 clone: from https://github.com/alfathdirk/LineAlphatJS.git
|
4
b.git/packed-refs
Normal file
|
@ -0,0 +1,4 @@
|
|||
# pack-refs with: peeled fully-peeled
|
||||
2640e4888b6dda45b2e9bc502a139e964fb1be84 refs/remotes/origin/master
|
||||
62a4cfcc42f1b733d5aab64d64bd1d3c1302e806 refs/tags/v1
|
||||
4841acf1de79d6c4cff28bede2b493223a1ceb6f refs/tags/v2.0
|
1
b.git/refs/heads/master
Normal file
|
@ -0,0 +1 @@
|
|||
2640e4888b6dda45b2e9bc502a139e964fb1be84
|
1
b.git/refs/remotes/origin/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
ref: refs/remotes/origin/master
|
41545
curve-thrift/TalkService.js
Normal file
12918
curve-thrift/line_types.js
Normal file
BIN
download/1.mp4
Normal file
BIN
download/ML.jpg
Normal file
After Width: | Height: | Size: 649 KiB |
BIN
download/ML.mp3
Normal file
BIN
download/Owner.jpg
Normal file
After Width: | Height: | Size: 937 KiB |
BIN
download/anjing.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
download/asal kau bahagia.mp3
Normal file
BIN
download/baby shark.mp3
Normal file
BIN
download/bot1.m4a
Normal file
BIN
download/bot2.m4a
Normal file
BIN
download/broken.m4a
Normal file
BIN
download/bugil.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
download/canon rock.mp3
Normal file
BIN
download/closer.mp3
Normal file
BIN
download/dear god.mp3
Normal file
BIN
download/despacito.mp3
Normal file
BIN
download/dusk till dawn.mp3
Normal file
BIN
download/faded.mp3
Normal file
BIN
download/funny.m4a
Normal file
BIN
download/goyang dumang.mp3
Normal file
BIN
download/hilang.mp3
Normal file
BIN
download/jadi aku sebentar saja.mp3
Normal file
BIN
download/jaran goyang.mp3
Normal file
BIN
download/kaget.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
download/kucing.jpg
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
download/mendua.mp3
Normal file
BIN
download/naked.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
download/perfect.mp3
Normal file
BIN
download/pocong.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
download/rockabye.mp3
Normal file
BIN
download/salah.mp3
Normal file
BIN
download/sayang.mp3
Normal file
BIN
download/shape of you.mp3
Normal file
BIN
download/simfoni.m4a
Normal file
BIN
download/siul.m4a
Normal file
BIN
download/spongebob.m4a
Normal file
BIN
download/tai.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
download/taik.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
download/tentang rasa.mp3
Normal file
BIN
download/tete.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
download/titanic.m4a
Normal file
BIN
download/titid.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
download/tt.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
download/tytyd.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
50
helpers/instagram.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
let exec = require('child_process').exec
|
||||
|
||||
module.exports = (usernameIG) => {
|
||||
let cmd = 'wget https://instagram.com/'+usernameIG+' -qO -';
|
||||
let medias = [];
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(cmd,function(err,so){
|
||||
if(err) {
|
||||
reject(err);
|
||||
return err;
|
||||
}
|
||||
output = so.split('window._sharedData = ')
|
||||
if(output.length > 1){
|
||||
let dataScrap = output[1].split(';</script>')
|
||||
let tojson = JSON.parse(dataScrap[0]);
|
||||
let userProfile = tojson.entry_data.ProfilePage[0].user
|
||||
let follower = userProfile.followed_by.count
|
||||
let following = userProfile.follows.count
|
||||
let bio = userProfile.biography
|
||||
let username = userProfile.username
|
||||
let profilePic = userProfile.profile_pic_url
|
||||
let fullname = userProfile.full_name
|
||||
let name = fullname || username
|
||||
let media = userProfile.media.nodes
|
||||
|
||||
if( media.length > 0 ){
|
||||
for (var i = 0; i < 2; i++) {
|
||||
if(typeof media[i].thumbnail_src !== 'undefined') {
|
||||
medias.push(media[i].thumbnail_src);
|
||||
} else {
|
||||
medias = ' No Photo Uploaded ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
medias = '- User Is Private -';
|
||||
}
|
||||
let data = {
|
||||
userProfile: userProfile.profile_pic_url,
|
||||
userName: name,
|
||||
bio : bio,
|
||||
media: medias,
|
||||
follow :`Follower: ${follower} <=> Following: ${following}`,
|
||||
};
|
||||
resolve(data)
|
||||
} else {
|
||||
resolve('not found')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
25
helpers/lirik.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
module.exports = (title) => {
|
||||
const Nightmare = require('nightmare');
|
||||
const nightmare = Nightmare({ show: true });
|
||||
if(!title) {
|
||||
return 'please input title';
|
||||
}
|
||||
let lirik = 'lirik '+process.argv[2];
|
||||
return new Promise((resolve, reject) => {
|
||||
nightmare
|
||||
.goto(`https://www.google.com/search?q=${lirik.replace(/ /g,'+')}`)
|
||||
.wait('#resultStats')
|
||||
.click('h3.r a')
|
||||
.evaluate(() => document.querySelectorAll('.col-lirik.lyrics-body')[0].innerText)
|
||||
.end()
|
||||
.then((dataLyrics) => {
|
||||
resolve(dataLyrics);
|
||||
return;
|
||||
})
|
||||
.catch((error) => {
|
||||
reject('Search failed');
|
||||
return 'Search failed:', error;
|
||||
});
|
||||
})
|
||||
}
|
1536
package-lock.json
generated
Normal file
31
package.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "linealphatjs",
|
||||
"version": "0.2.1",
|
||||
"description": "LineAlphat JS",
|
||||
"main": "./library/main.js",
|
||||
"scripts": {
|
||||
"start": "npm run bot",
|
||||
"bot": "node ./src/bot.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alfathdirk/LineAlphatJS.git"
|
||||
},
|
||||
"author": {
|
||||
"name": "alfathdirk",
|
||||
"email": "alfathdirk@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"qrcode-terminal": "^0.11.0",
|
||||
"node-bignumber": "^1.2.1",
|
||||
"utf8": "^2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "^3.3.4",
|
||||
"nightmare": "^2.10.0",
|
||||
"thrift": "^0.9.3",
|
||||
"thrift-http": "^1.0.1",
|
||||
"unirest": "^0.5.0"
|
||||
}
|
||||
}
|
422
src/api.js
Normal file
|
@ -0,0 +1,422 @@
|
|||
const thrift = require('thrift-http');
|
||||
const unirest = require('unirest');
|
||||
const qrcode = require('qrcode-terminal');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Lyrics = require('../helpers/lirik');
|
||||
const Ig = require('../helpers/instagram');
|
||||
|
||||
const TalkService = require('../curve-thrift/TalkService');
|
||||
|
||||
const {
|
||||
LoginResultType,
|
||||
IdentityProvider,
|
||||
ContentType,
|
||||
Message
|
||||
} = require('../curve-thrift/line_types');
|
||||
|
||||
|
||||
const PinVerifier = require('./pinVerifier');
|
||||
const config = require('./config');
|
||||
|
||||
class LineAPI {
|
||||
constructor() {
|
||||
this.config = config;
|
||||
this.setTHttpClient();
|
||||
}
|
||||
|
||||
setTHttpClient(options = {
|
||||
protocol: thrift.TCompactProtocol,
|
||||
transport: thrift.TBufferedTransport,
|
||||
headers: this.config.Headers,
|
||||
path: this.config.LINE_HTTP_URL,
|
||||
https: true
|
||||
}) {
|
||||
// options.headers['X-Line-Application'] = 'DESKTOPMAC 10.10.2-YOSEMITE-x64 MAC 4.5.1';
|
||||
options.headers['X-Line-Application'] = 'CHROMEOS\x091.4.13\x09Chrome_OS\x091';
|
||||
this.options = options;
|
||||
this.connection =
|
||||
thrift.createHttpConnection(this.config.LINE_DOMAIN, 443, this.options);
|
||||
this.connection.on('error', (err) => {
|
||||
console.log('err',err);
|
||||
return err;
|
||||
});
|
||||
this._client = thrift.createHttpClient(TalkService, this.connection);
|
||||
|
||||
}
|
||||
|
||||
_tokenLogin(authToken, certificate) {
|
||||
this.config.Headers['X-Line-Access'] = authToken;
|
||||
this.setTHttpClient();
|
||||
return Promise.resolve({ authToken, certificate });
|
||||
}
|
||||
|
||||
_qrCodeLogin() {
|
||||
this.setTHttpClient();
|
||||
return new Promise((resolve, reject) => {
|
||||
this._client.getAuthQrcode(true, 'Nadya',(err, result) => {
|
||||
// console.log('here')
|
||||
const qrcodeUrl = `line://au/q/${result.verifier}`;
|
||||
qrcode.generate(qrcodeUrl,{small: true});
|
||||
console.info(`\n\nlink qr code is: ${qrcodeUrl}`)
|
||||
Object.assign(this.config.Headers,{ 'X-Line-Access': result.verifier });
|
||||
unirest.get(`https://${this.config.LINE_DOMAIN}/Q`)
|
||||
.headers(this.config.Headers)
|
||||
.timeout(120000)
|
||||
.end(async (res) => {
|
||||
const verifiedQr = res.body.result.verifier;
|
||||
const { authToken, certificate } =
|
||||
await this._client.loginWithVerifierForCerificate(verifiedQr);
|
||||
this.options.headers['X-Line-Access'] = authToken;
|
||||
// this.options.path = this.config.LINE_COMMAND_PATH;
|
||||
this.setTHttpClient();
|
||||
resolve({ authToken, certificate });
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_login(id, password) {
|
||||
const pinVerifier = new PinVerifier(id, password);
|
||||
return new Promise((resolve, reject) => (
|
||||
this._setProvider(id)
|
||||
.then(() => {
|
||||
this.setTHttpClient();
|
||||
this._client.getRSAKeyInfo(this.provider, (key, credentials) => {
|
||||
const rsaCrypto = pinVerifier.getRSACrypto(credentials);
|
||||
try {
|
||||
this._client.loginWithIdentityCredentialForCertificate(
|
||||
this.provider, rsaCrypto.keyname, rsaCrypto.credentials,
|
||||
true, this.config.ip, 'purple-line', '',
|
||||
(err, result) => {
|
||||
if (err) {
|
||||
console.log('LoginFailed');
|
||||
console.error(err);
|
||||
return reject(err);
|
||||
}
|
||||
this._client.pinCode = result.pinCode;
|
||||
this.alertOrConsoleLog(
|
||||
`Enter Pincode ${result.pinCode}
|
||||
to your mobile phone in 2 minutes`
|
||||
);
|
||||
this._checkLoginResultType(result.type, result);
|
||||
this._loginWithVerifier(result)
|
||||
.then((verifierResult) => {
|
||||
this._checkLoginResultType(verifierResult.type, verifierResult);
|
||||
resolve(verifierResult);
|
||||
});
|
||||
});
|
||||
} catch(error) {
|
||||
console.log('error');
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
_loginWithVerifier() {
|
||||
return this.getJson(this.config.LINE_CERTIFICATE_URL)
|
||||
.then(
|
||||
(json) =>
|
||||
this._client.loginWithVerifierForCertificate(json.result.verifier)
|
||||
, (err) => console.log(`LoginWithVerifierForCertificate Error: ${err}`)
|
||||
);
|
||||
}
|
||||
|
||||
_setProvider(id) {
|
||||
this.provider = this.config.EMAIL_REGEX.test(id) ?
|
||||
IdentityProvider.LINE :
|
||||
IdentityProvider.NAVER_KR;
|
||||
|
||||
return this.provider === IdentityProvider.LINE ?
|
||||
this.getJson(this.config.LINE_SESSION_LINE_URL) :
|
||||
this.getJson(this.config.LINE_SESSION_NAVER_URL);
|
||||
}
|
||||
|
||||
_checkLoginResultType(type, result) {
|
||||
this.config.Headers['X-Line-Access'] = result.authToken || result.verifier;
|
||||
if (result.type === LoginResultType.SUCCESS) {
|
||||
this.certificate = result.certificate;
|
||||
this.authToken = result.authToken;
|
||||
} else if (result.type === LoginResultType.REQUIRE_QRCODE) {
|
||||
console.log('require QR code');
|
||||
} else if (result.type === LoginResultType.REQUIRE_DEVICE_CONFIRM) {
|
||||
console.log('require device confirm');
|
||||
} else {
|
||||
throw new Error('unkown type');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async _sendMessage(message, txt ,seq = 0) {
|
||||
message.text = txt;
|
||||
return await this._client.sendMessage(0, message);
|
||||
}
|
||||
|
||||
_kickMember(group,memid) {
|
||||
return this._client.kickoutFromGroup(0,group,memid);
|
||||
}
|
||||
|
||||
_cancel(groupid,member) {
|
||||
return this._client.cancelGroupInvitation(0,groupid,member);
|
||||
}
|
||||
|
||||
async _getGroupsJoined() {
|
||||
return await this._client.getGroupIdsJoined()
|
||||
}
|
||||
|
||||
async _getGroupsInvited() {
|
||||
return await this._client.getGroupIdsInvited();
|
||||
}
|
||||
|
||||
async _myProfile() {
|
||||
return await this._client.getProfile();
|
||||
}
|
||||
|
||||
_inviteIntoGroup(group,memid) {
|
||||
return this._client.inviteIntoGroup(0,group,memid);
|
||||
}
|
||||
|
||||
async _findGroupByName(name) {
|
||||
let group = [];
|
||||
let groupID = await this._getGroupsJoined();
|
||||
let groups = await this._getGroups(groupID);
|
||||
for (let key in groups) {
|
||||
if(groups[key].name === name){
|
||||
group.push(groups[key]);
|
||||
}
|
||||
}
|
||||
return group;
|
||||
|
||||
}
|
||||
|
||||
async _refrehGroup() {
|
||||
await this._getGroupsInvited();
|
||||
await this._getGroupsJoined();
|
||||
return;
|
||||
}
|
||||
|
||||
_rejectGroupInvitation(groupIds) {
|
||||
return this._client.rejectGroupInvitation(0,groupIds);
|
||||
}
|
||||
|
||||
async _createGroup(groupName,members) {
|
||||
await this._getAllContactIds();
|
||||
return this._client.createGroup(0,groupName,members);
|
||||
}
|
||||
|
||||
async _getAllContactIds(){
|
||||
return await this._client.getAllContactIds();
|
||||
}
|
||||
|
||||
async _createRoom(memberids) {
|
||||
return await this._client.createRoom(0,[memberids]);
|
||||
}
|
||||
|
||||
async _acceptGroupInvitation(groupid) {
|
||||
this._client.acceptGroupInvitation(0,groupid);
|
||||
await this._refrehGroup();
|
||||
return;
|
||||
}
|
||||
|
||||
_invite(group,member) {
|
||||
return this._client.inviteIntoGroup(0, group, member)
|
||||
}
|
||||
|
||||
async _updateGroup(group) {
|
||||
return await this._client.updateGroup(0, group)
|
||||
}
|
||||
|
||||
async _updateProfile(profile) {
|
||||
return await this._client.updateProfile(0, profile)
|
||||
}
|
||||
|
||||
_getContacts(mid) {
|
||||
return this._client.getContacts(mid)
|
||||
}
|
||||
|
||||
async _getGroups(groupId) {
|
||||
return await this._client.getGroups(groupId);
|
||||
}
|
||||
|
||||
async _getGroup(groupId) {
|
||||
return await this._client.getGroup(groupId);
|
||||
}
|
||||
|
||||
_leaveGroup(gid) {
|
||||
return this._client.leaveGroup(0,gid);
|
||||
}
|
||||
|
||||
async _reissueGroupTicket(groupId) {
|
||||
return await this._client.reissueGroupTicket(groupId);
|
||||
}
|
||||
|
||||
async _findGroupByTicket(ticketID){
|
||||
return await this._client.findGroupByTicket(ticketID);
|
||||
}
|
||||
|
||||
async _acceptGroupInvitationByTicket(gid,ticketID){
|
||||
this._refrehGroup();
|
||||
return await this._client.acceptGroupInvitationByTicket(0,gid,ticketID);
|
||||
}
|
||||
|
||||
async _sendFileByUrl(message,uri) {
|
||||
let media = 1;
|
||||
if (!fs.existsSync(__dirname+'/tmp')){
|
||||
await fs.mkdirSync(__dirname+'/tmp');
|
||||
}
|
||||
let head = await unirest.head(uri,async (res) => {
|
||||
let formatFile = res.headers['content-type'].split('/')[1].toLowerCase();
|
||||
let locationFile = __dirname + `/tmp/${Math.floor(Math.random() * 100)}.${formatFile}`;
|
||||
await unirest.get(uri).end().pipe(fs.createWriteStream(locationFile));
|
||||
return this._sendFile(message,locationFile,media);
|
||||
});
|
||||
}
|
||||
|
||||
async _sendImageByUrl(message,uri) {
|
||||
await this._sendFileByUrl(message,uri);
|
||||
}
|
||||
|
||||
async _sendImage(message, filePath) {
|
||||
this._sendFile(message,filePath, 1);
|
||||
}
|
||||
|
||||
async _download(uri,name,type) {
|
||||
let formatType;
|
||||
switch (type) {
|
||||
case 3:
|
||||
formatType = 'm4a';
|
||||
break;
|
||||
default:
|
||||
formatType = 'jpg';
|
||||
break;
|
||||
}
|
||||
let dir = __dirname+'/../download';
|
||||
if (!fs.existsSync(dir)){
|
||||
await fs.mkdirSync(dir);
|
||||
}
|
||||
await unirest
|
||||
.get(uri)
|
||||
.headers({
|
||||
...this.config.Headers
|
||||
})
|
||||
.end((res) => {
|
||||
if(res.error) {
|
||||
console.log(res.error);
|
||||
return 'err';
|
||||
}
|
||||
}).pipe(fs.createWriteStream(`${dir}/${name}.${formatType}`));
|
||||
}
|
||||
|
||||
async _sendFile(message,filepaths, typeContent = 1) {
|
||||
let filename = 'media';
|
||||
let typeFile;
|
||||
|
||||
switch (typeContent) {
|
||||
case 2:
|
||||
typeFile = 'video'
|
||||
break;
|
||||
case 3:
|
||||
typeFile = 'audio'
|
||||
break;
|
||||
default:
|
||||
typeFile = 'image'
|
||||
break;
|
||||
}
|
||||
|
||||
let M = new Message();
|
||||
M.to = message.to;
|
||||
M.contentType= typeContent;
|
||||
M.contentPreview= null;
|
||||
M.contentMetadata= null;
|
||||
|
||||
|
||||
const filepath = path.resolve(__dirname,filepaths)
|
||||
console.log('File Locate on',filepath);
|
||||
fs.readFile(filepath,async (err, bufs) => {
|
||||
let imgID = await this._client.sendMessage(0,M);
|
||||
const data = {
|
||||
params: JSON.stringify({
|
||||
name: filename,
|
||||
oid: imgID.id,
|
||||
size: bufs.length,
|
||||
type: typeFile,
|
||||
ver: '1.0'
|
||||
})
|
||||
};
|
||||
return this
|
||||
.postContent(config.LINE_POST_CONTENT_URL, data, filepath)
|
||||
.then((res) => {
|
||||
if(res.err) {
|
||||
console.log('err',res.error)
|
||||
return;
|
||||
}
|
||||
console.log(res.headers);
|
||||
if(filepath.search(/download\//g) === -1) {
|
||||
fs.unlink(filepath, (err) => {
|
||||
if (err) {
|
||||
console.log('err on upload',err);
|
||||
return err
|
||||
};
|
||||
console.log(`successfully deleted ${filepath}`);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
postContent(url, data = null, filepath = null) {
|
||||
return new Promise((resolve, reject) => (
|
||||
unirest.post(url)
|
||||
.headers({
|
||||
...this.config.Headers,
|
||||
'Content-Type': 'multipart/form-data'
|
||||
})
|
||||
.timeout(120000)
|
||||
.field(data)
|
||||
.attach('files', filepath)
|
||||
.end((res) => {
|
||||
if(res.err) {
|
||||
console.error('error on post to server');
|
||||
reject(res.error);
|
||||
return;
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
async _fetchOperations(revision, count) {
|
||||
// this.options.path = this.config.LINE_POLL_URL
|
||||
return await this._client.fetchOperations(revision, count);
|
||||
}
|
||||
|
||||
_fetchOps(revision, count = 5) {
|
||||
return this._client.fetchOps(revision, count,0,0);
|
||||
}
|
||||
|
||||
getJson(path) {
|
||||
return new Promise((resolve, reject) => (
|
||||
unirest.get(`https://${this.config.LINE_DOMAIN}${path}`)
|
||||
.headers(this.config.Headers)
|
||||
.timeout(120000)
|
||||
.end((res) => (
|
||||
res.error ? reject(res.error) : resolve(res.body)
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
async _searchLyrics(title) {
|
||||
let lirik = await Lyrics(title);
|
||||
return lirik
|
||||
}
|
||||
|
||||
async _searchInstagram(username) {
|
||||
let ig = await Ig(username);
|
||||
return ig
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LineAPI;
|
27
src/bot.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const LineConnect = require('./connect');
|
||||
let line = require('./main.js');
|
||||
let LINE = new line();
|
||||
|
||||
const auth = {
|
||||
authToken: 'HERE',
|
||||
certificate: 'HERE'
|
||||
}
|
||||
//let client = new LineConnect(auth);
|
||||
let client = new LineConnect();
|
||||
|
||||
client.startx().then(async (res) => {
|
||||
|
||||
while(true) {
|
||||
try {
|
||||
ops = await client.fetchOps(res.operation.revision);
|
||||
} catch(error) {
|
||||
console.log('error',error)
|
||||
}
|
||||
for (let op in ops) {
|
||||
if(ops[op].revision.toString() != -1){
|
||||
res.operation.revision = ops[op].revision;
|
||||
LINE.poll(ops[op])
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
772
src/command.js
Normal file
|
@ -0,0 +1,772 @@
|
|||
const LineAPI = require('./api');
|
||||
|
||||
let exec = require('child_process').exec;
|
||||
|
||||
class Command extends LineAPI {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.spamName = [];
|
||||
}
|
||||
|
||||
get payload() {
|
||||
if(typeof this.messages !== 'undefined'){
|
||||
return (this.messages.text !== null) ? this.messages.text.split(' ').splice(1) : '' ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async getProfile() {
|
||||
let { displayName } = await this._myProfile();
|
||||
return displayName;
|
||||
}
|
||||
|
||||
|
||||
async cancelMember() {
|
||||
let groupID;
|
||||
if(this.payload.length > 0) {
|
||||
let [ groups ] = await this._findGroupByName(this.payload.join(' '));
|
||||
groupID = groups.id;
|
||||
}
|
||||
let gid = groupID || this.messages.to;
|
||||
let { listPendingInvite } = await this.searchGroup(gid);
|
||||
if(listPendingInvite.length > 0){
|
||||
this._cancel(gid,listPendingInvite);
|
||||
}
|
||||
}
|
||||
|
||||
async searchGroup(gid) {
|
||||
let listPendingInvite = [];
|
||||
let thisgroup = await this._getGroups([gid]);
|
||||
if(thisgroup[0].invitee !== null) {
|
||||
listPendingInvite = thisgroup[0].invitee.map((key) => {
|
||||
return key.mid;
|
||||
});
|
||||
}
|
||||
let listMember = thisgroup[0].members.map((key) => {
|
||||
return { mid: key.mid, dn: key.displayName };
|
||||
});
|
||||
|
||||
return {
|
||||
listMember,
|
||||
listPendingInvite
|
||||
}
|
||||
}
|
||||
|
||||
OnOff() {
|
||||
if(this.isAdminOrBot(this.messages.from)){
|
||||
let [ actions , status ] = this.messages.text.split(' ');
|
||||
const action = actions.toLowerCase();
|
||||
const state = status.toLowerCase() == 'on' ? 1 : 0;
|
||||
this.stateStatus[action] = state;
|
||||
this._sendMessage(this.messages,`Status: \n${JSON.stringify(this.stateStatus)}`);
|
||||
} else {
|
||||
this._sendMessage(this.messages,`Kamu Bukan Admin, Mau Jadi Admin? PC Admin1`);
|
||||
this._sendMessage(this.messages,`Ketik Keyword Ini Untuk Melihat Admin : Admin1 Admin2 Admin3 Admin4 Admin5 Admin6 Admin7 Admin8 Admin9 Admin10 Admin11 Admin12 Admin13 Admin14 Admin15`);
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
mention(listMember) {
|
||||
let mentionStrings = [''];
|
||||
let mid = [''];
|
||||
for (var i = 0; i < listMember.length; i++) {
|
||||
mentionStrings.push('@'+listMember[i].displayName+'\n');
|
||||
mid.push(listMember[i].mid);
|
||||
}
|
||||
let strings = mentionStrings.join('');
|
||||
let member = strings.split('@').slice(1);
|
||||
|
||||
let tmp = 0;
|
||||
let memberStart = [];
|
||||
let mentionMember = member.map((v,k) => {
|
||||
let z = tmp += v.length + 1;
|
||||
let end = z - 1;
|
||||
memberStart.push(end);
|
||||
let mentionz = `{"S":"${(isNaN(memberStart[k - 1] + 1) ? 0 : memberStart[k - 1] + 1 ) }","E":"${end}","M":"${mid[k + 1]}"}`;
|
||||
return mentionz;
|
||||
})
|
||||
return {
|
||||
names: mentionStrings.slice(1),
|
||||
cmddata: { MENTION: `{"MENTIONEES":[${mentionMember}]}` }
|
||||
}
|
||||
}
|
||||
|
||||
async leftGroupByName(name) {
|
||||
let payload = name || this.payload.join(' ');
|
||||
let gid = await this._findGroupByName(payload);
|
||||
for (let i = 0; i < gid.length; i++) {
|
||||
this._leaveGroup(gid[i].id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
async recheck(cs,group) {
|
||||
let users;
|
||||
for (var i = 0; i < cs.length; i++) {
|
||||
if(cs[i].group == group) {
|
||||
users = cs[i].users;
|
||||
}
|
||||
}
|
||||
|
||||
let contactMember = await this._getContacts(users);
|
||||
return contactMember.map((z) => {
|
||||
return { displayName: z.displayName, mid: z.mid };
|
||||
});
|
||||
}
|
||||
|
||||
removeReaderByGroup(groupID) {
|
||||
const groupIndex = this.checkReader.findIndex(v => {
|
||||
if(v.group == groupID) {
|
||||
return v
|
||||
}
|
||||
})
|
||||
|
||||
if(groupIndex != -1) {
|
||||
this.checkReader.splice(groupIndex,1);
|
||||
}
|
||||
}
|
||||
|
||||
async getSpeed() {
|
||||
let curTime = Date.now() / 1000;
|
||||
await this._sendMessage(this.messages, 'Loading. . .');
|
||||
const rtime = (Date.now() / 1000) - curTime;
|
||||
await this._sendMessage(this.messages, `${rtime} Second`);
|
||||
return;
|
||||
}
|
||||
|
||||
async tagall() {
|
||||
let rec = await this._getGroup(this.messages.to);
|
||||
const mentions = await this.mention(rec.members);
|
||||
this.messages.contentMetadata = mentions.cmddata;
|
||||
await this._sendMessage(this.messages,mentions.names.join(''));
|
||||
return;
|
||||
}
|
||||
|
||||
async tagall2() {
|
||||
let rec = await this._getGroup(this.messages.to);
|
||||
const mentions = await this.mention(rec.members);
|
||||
this.messages.contentMetadata = mentions.cmddata;
|
||||
await this._sendMessage(this.messages,mentions.names.join(''));
|
||||
return;
|
||||
}
|
||||
|
||||
vn() {
|
||||
this._sendFile(this.messages,`${__dirname}/../download/${this.payload.join(' ')}.m4a`,3);
|
||||
}
|
||||
|
||||
lagu() {
|
||||
{
|
||||
this._sendFile(this.messages,`${__dirname}/../download/${this.payload.join(' ')}.mp3`,3);
|
||||
}
|
||||
{
|
||||
this._sendMessage(this.messages, `Ok, Sabar Ya Kak, Tungguin... Lagu Kakak Lagi Aku Prosses ^_^`);
|
||||
}
|
||||
}
|
||||
|
||||
video() {
|
||||
{
|
||||
this._sendFile(this.messages,`${__dirname}/../download/${this.payload.join(' ')}.mp4`,2);
|
||||
}
|
||||
this._sendMessage(this.messages, `Ok, Sabar Ya Kak, Tungguin... Video Kakak Lagi Aku Prosses ^_^`);
|
||||
}
|
||||
|
||||
checkKernel() {
|
||||
exec('uname -a',(err, sto) => {
|
||||
if(err) {
|
||||
this._sendMessage(this.messages, err);
|
||||
return
|
||||
}
|
||||
this._sendMessage(this.messages, sto);
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
setReader() {
|
||||
this._sendMessage(this.messages, "#↔️↔️↔️↔️ CCTV AKTIF ↔️↔️↔️↔️️#"+
|
||||
" #️ Ketik Cyduk Untuk Melihat Sider! ️#");
|
||||
this.removeReaderByGroup(this.messages.to);
|
||||
return;
|
||||
}
|
||||
|
||||
keluar() {
|
||||
{ this._sendMessage(this.messages, `Apakah Kamu Yakin Mau Ngusir Aku??? :(`);
|
||||
}
|
||||
{
|
||||
this._sendMessage(this.messages, `Ketik "#ya" Atau "#tidak"`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
batal() {
|
||||
this._sendMessage(this.messages, `Yaaay..., Maaciih Karna Udah Gak Jadi Ngusir Aku ^__^`);
|
||||
}
|
||||
|
||||
|
||||
spam2() {
|
||||
this._sendMessage(this.messages, `3`);
|
||||
this._sendMessage(this.messages, `2`);
|
||||
this._sendMessage(this.messages, `1`);
|
||||
this._sendMessage(this.messages, `Fuck Off`);
|
||||
this._sendMessage(this.messages, `Ku mengejar bus yang mulai berjalan`);
|
||||
this._sendMessage(this.messages, `Ku ingin ungkapkan kepada dirimu`);
|
||||
this._sendMessage(this.messages, `Kabut dalam hatiku telah menghilang`);
|
||||
this._sendMessage(this.messages, `Dan hal yang penting bagiku pun terlihat`);
|
||||
this._sendMessage(this.messages, `Walaupun jawaban itu sebenarnya begitu mudah`);
|
||||
this._sendMessage(this.messages, `Tetapi entah mengapa diriku melewatkannya`);
|
||||
this._sendMessage(this.messages, `Untukku menjadi diri sendiri`);
|
||||
this._sendMessage(this.messages, `Ku harus jujur, pada perasaanku`);
|
||||
this._sendMessage(this.messages, `Ku suka dirimu ku suka`);
|
||||
this._sendMessage(this.messages, `Ku berlari sekuat tenaga`);
|
||||
this._sendMessage(this.messages, `Ku suka selalu ku suka`);
|
||||
this._sendMessage(this.messages, `Ku teriak sebisa suaraku`);
|
||||
this._sendMessage(this.messages, `Ku suka dirimu ku suka`);
|
||||
this._sendMessage(this.messages, `Walau susah untukku bernapas`);
|
||||
this._sendMessage(this.messages, `Tak akan ku sembunyikan`);
|
||||
this._sendMessage(this.messages, `Oogoe daiyamondo~`);
|
||||
this._sendMessage(this.messages, `Saat ku sadari sesuatu menghilang`);
|
||||
this._sendMessage(this.messages, `Hati ini pun resah tidak tertahankan`);
|
||||
this._sendMessage(this.messages, `Sekarang juga yang bisa ku lakukan`);
|
||||
this._sendMessage(this.messages, `Merubah perasaan ke dalam kata kata`);
|
||||
this._sendMessage(this.messages, `Mengapa sedari tadi`);
|
||||
this._sendMessage(this.messages, `Aku hanya menatap langit`);
|
||||
this._sendMessage(this.messages, `Mataku berkaca kaca`);
|
||||
this._sendMessage(this.messages, `Berlinang tak bisa berhenti`);
|
||||
this._sendMessage(this.messages, `Di tempat kita tinggal, didunia ini`);
|
||||
this._sendMessage(this.messages, `Dipenuhi cinta, kepada seseorang`);
|
||||
this._sendMessage(this.messages, `Ku yakin ooo ku yakin`);
|
||||
this._sendMessage(this.messages, `Janji tak lepas dirimu lagi`);
|
||||
this._sendMessage(this.messages, `Ku yakin ooo ku yakin`);
|
||||
this._sendMessage(this.messages, `Akhirnya kita bisa bertemu`);
|
||||
this._sendMessage(this.messages, `Ku yakin ooo ku yakin`);
|
||||
this._sendMessage(this.messages, `Ku akan bahagiakan dirimu`);
|
||||
this._sendMessage(this.messages, `Ku ingin kau mendengarkan`);
|
||||
this._sendMessage(this.messages, `Oogoe daiyamondo~`);
|
||||
this._sendMessage(this.messages, `Jika jika kamu ragu`);
|
||||
this._sendMessage(this.messages, `Takkan bisa memulai apapun`);
|
||||
this._sendMessage(this.messages, `Ungkapkan perasaanmu`);
|
||||
this._sendMessage(this.messages, `Jujurlah dari sekarang juga`);
|
||||
this._sendMessage(this.messages, `Jika kau bersuar`);
|
||||
this._sendMessage(this.messages, `Cahaya kan bersinar`);
|
||||
this._sendMessage(this.messages, `Ku suka dirimu ku suka`);
|
||||
this._sendMessage(this.messages, `Ku berlari sekuat tenaga`);
|
||||
this._sendMessage(this.messages, `Ku suka selalu ku suka`);
|
||||
this._sendMessage(this.messages, `Ku teriak sebisa suaraku`);
|
||||
this._sendMessage(this.messages, `Ku suka dirimu ku suka`);
|
||||
this._sendMessage(this.messages, `Sampaikan rasa sayangku ini`);
|
||||
this._sendMessage(this.messages, `Ku suka selalu ku suka`);
|
||||
this._sendMessage(this.messages, `Ku teriakkan ditengah angin`);
|
||||
this._sendMessage(this.messages, `Ku suka dirimu ku suka`);
|
||||
this._sendMessage(this.messages, `Walau susah untuk ku bernapas`);
|
||||
this._sendMessage(this.messages, `Tak akan ku sembunyikan`);
|
||||
this._sendMessage(this.messages, `Oogoe daiyamondo~`);
|
||||
this._sendMessage(this.messages, `Katakan dengan berani`);
|
||||
this._sendMessage(this.messages, `Jika kau diam kan tetap sama`);
|
||||
this._sendMessage(this.messages, `Janganlah kau merasa malu`);
|
||||
this._sendMessage(this.messages, `“Suka” itu kata paling hebat!`);
|
||||
this._sendMessage(this.messages, `“Suka” itu kata paling hebat!`);
|
||||
this._sendMessage(this.messages, `“Suka” itu kata paling hebat!`);
|
||||
this._sendMessage(this.messages, `Ungkapkan perasaanmu`);
|
||||
this._sendMessage(this.messages, `Jujurlah dari sekarang juga..`);
|
||||
this._sendMessage(this.messages, `SPAM IS DONE`);
|
||||
return;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._sendMessage(this.messages, `List Sider Terhapus !`);
|
||||
this.checkReader = [];
|
||||
return
|
||||
}
|
||||
|
||||
list() {
|
||||
this._sendMessage(this.messages,`Ketik Keyword Ini Untuk Melihat Admin : Admin1 Admin2 Admin3 Admin4 Admin5 Admin6 Admin7 Admin8 Admin9 Admin10 Admin11 Admin12 Admin13 Admin14 Admin15`);
|
||||
}
|
||||
|
||||
creator() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u14f64e139a3817afaabe27d237afb36b'}
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin1() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u14f64e139a3817afaabe27d237afb36b'}
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin2() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u653c0c37cdaefb7f583023c02cb8384a' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin3() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u2297b268eec8988b3c32ffa058b0a248' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin4() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'uea50f7108c44b400a9f70b75f7848fcf' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin5() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u7235ccb3dd6b587f28fec4044901d710' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin6() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'ua89b571977cb320814c4175591db2d23' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin7() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u90a32052cf753761431423d1ee234591' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin8() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u8b8fad7361ed7c32a1b9c2448732f528' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin9() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u7cbe6149e62a5df0d42c46f590760601' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin10() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u8748762cfc5091da024235c27975a0e0' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin11() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'ue43a33a6ea6350447b7ca1de72e23c2e' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin12() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u8333a7b83f7742aa795672420d2376df' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin13() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'ud7fb95cc02f0f7d09898669633520040' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin14() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u7b62234875424b196927381b177112c9' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin15() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'uc486961efab83d61d218fa7d8a735661' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
admin16() {
|
||||
this._sendMessage(this.messages, `Admin 16 Belom Ada`);
|
||||
}
|
||||
|
||||
admin17() {
|
||||
this._sendMessage(this.messages, `Admin 17 Belom Ada`);
|
||||
}
|
||||
|
||||
admin18() {
|
||||
this._sendMessage(this.messages, `Admin 18 Belom Ada`);
|
||||
}
|
||||
|
||||
admin19() {
|
||||
this._sendMessage(this.messages, `Admin 19 Belom Ada`);
|
||||
}
|
||||
|
||||
admin20() {
|
||||
this._sendMessage(this.messages, `Admin 20 Belom Ada`);
|
||||
}
|
||||
|
||||
bot2() {
|
||||
let msg = {
|
||||
text:null,
|
||||
contentType: 13,
|
||||
contentPreview: null,
|
||||
contentMetadata:
|
||||
{ mid: 'u659f68789c0e74d37cdd97c0e879c73e' }
|
||||
}
|
||||
Object.assign(this.messages,msg);
|
||||
this._sendMessage(this.messages);
|
||||
}
|
||||
|
||||
|
||||
resetStateUpload() {
|
||||
this.stateUpload = {
|
||||
file: '',
|
||||
name: '',
|
||||
group: '',
|
||||
sender: ''
|
||||
};
|
||||
}
|
||||
|
||||
prepareUpload() {
|
||||
this.stateUpload = {
|
||||
file: true,
|
||||
name: this.payload.join(' '),
|
||||
group: this.messages.to,
|
||||
sender: this.messages.from
|
||||
};
|
||||
this._sendMessage(this.messages,` ${this.stateUpload.name}`);
|
||||
return;
|
||||
}
|
||||
|
||||
async doUpload({ id, contentType }) {
|
||||
let url = `https://obs-sg.line-apps.com/talk/m/download.nhn?oid=${id}`;
|
||||
await this._download(url,this.stateUpload.name, contentType);
|
||||
this.messages.contentType = 0;
|
||||
this._sendMessage(this.messages,` ${this.stateUpload.name} `);
|
||||
this.resetStateUpload()
|
||||
return;
|
||||
}
|
||||
|
||||
searchLocalImage() {
|
||||
let name = this.payload.join(' ');
|
||||
let dirName = `${__dirname}/../download/${name}.jpg`;
|
||||
try {
|
||||
this._sendImage(this.messages,dirName);
|
||||
} catch (error) {
|
||||
this._sendImage(this.messages,`No Photo #${name} Uploaded `);
|
||||
}
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
async joinQr() {
|
||||
const [ ticketId ] = this.payload[0].split('g/').splice(-1);
|
||||
let { id } = await this._findGroupByTicket(ticketId);
|
||||
await this._acceptGroupInvitationByTicket(id,ticketId);
|
||||
return;
|
||||
}
|
||||
|
||||
async qrOpenClose() {
|
||||
let updateGroup = await this._getGroup(this.messages.to);
|
||||
updateGroup.preventJoinByTicket = true;
|
||||
if(typeof this.payload !== 'undefined') {
|
||||
let [ type ] = this.payload;
|
||||
|
||||
if(type === 'open') {
|
||||
updateGroup.preventJoinByTicket = false;
|
||||
const groupUrl = await this._reissueGroupTicket(this.messages.to)
|
||||
this._sendMessage(this.messages,`Line group = line://ti/g/${groupUrl}`);
|
||||
}
|
||||
}
|
||||
await this._updateGroup(updateGroup);
|
||||
return;
|
||||
}
|
||||
|
||||
spamGroup() {
|
||||
if(this.isAdminOrBot(this.messages.from) && this.payload[0] !== 'kill') {
|
||||
let s = [];
|
||||
for (let i = 0; i < this.payload[1]; i++) {
|
||||
let name = `${Math.ceil(Math.random() * 1000)}${i}`;
|
||||
this.spamName.push(name);
|
||||
this._createGroup(name,[this.payload[0]]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (let z = 0; z < this.spamName.length; z++) {
|
||||
this.leftGroupByName(this.spamName[z]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
checkIP() {
|
||||
exec(`wget ipinfo.io/${this.payload[0]} -qO -`,(err, res) => {
|
||||
if(err) {
|
||||
this._sendMessage(this.messages,'Error Please Install Wget');
|
||||
return
|
||||
}
|
||||
const result = JSON.parse(res);
|
||||
if(typeof result.error == 'undefined') {
|
||||
const { org, country, loc, city, region } = result;
|
||||
try {
|
||||
const [latitude, longitude ] = loc.split(',');
|
||||
let location = new Location();
|
||||
Object.assign(location,{
|
||||
title: `Location:`,
|
||||
address: `${org} ${city} [ ${region} ]\n${this.payload[0]}`,
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
phone: null
|
||||
})
|
||||
const Obj = {
|
||||
text: 'Location',
|
||||
location : location,
|
||||
contentType: 0,
|
||||
}
|
||||
Object.assign(this.messages,Obj)
|
||||
this._sendMessage(this.messages,'Location');
|
||||
} catch (err) {
|
||||
this._sendMessage(this.messages,'Not Found');
|
||||
}
|
||||
} else {
|
||||
this._sendMessage(this.messages,'Location Not Found , Maybe di dalem goa');
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
async rechecks() {
|
||||
let rec = await this.recheck(this.checkReader,this.messages.to);
|
||||
const mentions = await this.mention(rec);
|
||||
this.messages.contentMetadata = mentions.cmddata;
|
||||
await this._sendMessage(this.messages,mentions.names.join('')+
|
||||
|
||||
"#↔️↔️↔️️↔️Sider Tercyduk↔️↔️↔️↔️#"+
|
||||
" ️#Ketik Clear Untuk Hapus List Sider#");
|
||||
return;
|
||||
}
|
||||
|
||||
infokick() {
|
||||
this._sendMessage(this.messages, `Cara Menggunakan Fitur Kickall :
|
||||
1. Ketik Kick on
|
||||
2. Kalau Seperti Ini Berarti Kick Mode Sudah On
|
||||
Status:
|
||||
"cancel":0,"kick":1
|
||||
3. Terakhir, Kamu Ketik Kickall (Gak Pake Spasi)
|
||||
4. Done~`);
|
||||
}
|
||||
|
||||
|
||||
async kickAll() {
|
||||
let groupID;
|
||||
if(this.stateStatus.kick == 1 && this.isAdminOrBot(this.messages.from)) {
|
||||
let target = this.messages.to;
|
||||
if(this.payload.length > 0) {
|
||||
let [ groups ] = await this._findGroupByName(this.payload.join(' '));
|
||||
groupID = groups.id;
|
||||
}
|
||||
let { listMember } = await this.searchGroup(groupID || target);
|
||||
for (var i = 0; i < listMember.length; i++) {
|
||||
if(!this.isAdminOrBot(listMember[i].mid)){
|
||||
this._kickMember(groupID || target,[listMember[i].mid])
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
return this._sendMessage(this.messages, ' Kick Error, Fitur Kick Hanya Untuk Admin Saja!');
|
||||
}
|
||||
|
||||
help() {
|
||||
this._sendMessage(this.messages, ` 👤 Keyword Khusus Admin 👤
|
||||
[🔹]Kick On/Off ⏩ Mode Kick
|
||||
[🔹]Kickall ⏩ Mengekick Semua Member
|
||||
[🔹]Info kick ⏩ Cara Memakai Kickall
|
||||
[🔹]Cancel On/Off ⏩ Mode Cancel
|
||||
[🔹]Cancelall ⏩ Cancel Semua Invite
|
||||
[🔹]Qrp On/Off ⏩ Protect Link QR
|
||||
|
||||
👥 Keyword Dalam Group 👥
|
||||
[🔹]Chucky keluar ⏩ Bot Keluar
|
||||
[🔹]Status ⏩ Status Cancel/Kick/Qrp
|
||||
[🔹]Speed ⏩ Ngetest Respons Bot
|
||||
[🔹]Left NamaGroup ⏩ Bot Keluar
|
||||
[🔹]Setpoint/Set/Cctv ⏩ Cctv Aktif
|
||||
[🔹]Recheck/Check ⏩ Cek Sider
|
||||
[🔹]Clear/Reset ⏩ Hapus List Sider
|
||||
[🔹]Myid ⏩ Untuk Mengetahui MID
|
||||
[🔹]Ig Ursname Kamu ⏩ Info Instagram
|
||||
[🔹]Qr Open/Close ⏩ Link Group
|
||||
[🔹]spam (S Kecil) ⏩ Bot Akan Spam
|
||||
[🔹]List admin ⏩ Melihat Daftar Admin
|
||||
[🔹]Tag all ⏩ Mengetag Semua Member
|
||||
[🔹]Creator ⏩ Owner Pembuat Bot
|
||||
[🔹]Gift ⏩ Gift Sticker & Gift Tema
|
||||
[🔹]Suara bot1/bot2 ⏩ Suara Bot
|
||||
[🔹]Media ⏩ Daftar Pap & Musik
|
||||
#↔️↔️↔️↔️↔️↔️↔️↔️↔️↔️↔️↔️↔️↔#`);
|
||||
}
|
||||
|
||||
media() {
|
||||
this._sendMessage(this.messages, ` 🎶 Keyword Media 🎶
|
||||
[🔹]Pap owner/tt/tete/naked/bugil/pocong/titid/tytyd/kaget/tai/taik/kucing/anjing ⏩ Untuk Melihat Gambar Yang Dipilih
|
||||
|
||||
[🔹]Musik funny/broken/siul/spongebob/simfoni/titanic ⏩ Bot Akan Send Musik Yang Dipilih
|
||||
|
||||
[🔹]List lagu1 ⏩ Melihat Daftar Lagu
|
||||
[🔹]List lagu2 ⏩ Melihat Daftar Lagu`);
|
||||
}
|
||||
|
||||
listlagu1() {
|
||||
this._sendMessage(this.messages, ` 🎶 List Lagu 1 🎶
|
||||
[🎵]/lagu baby shark
|
||||
[🎵]/lagu ML
|
||||
[🎵]/lagu despacito
|
||||
[🎵]/lagu faded
|
||||
[🎵]/lagu dear god
|
||||
[🎵]/lagu jadi aku sebentar saja
|
||||
[🎵]/lagu mendua
|
||||
[🎵]/lagu tentang rasa
|
||||
[🎵]/lagu sayang
|
||||
[🎵]/lagu jaran goyang
|
||||
[🎵]/lagu goyang dumang`);
|
||||
}
|
||||
|
||||
listlagu2() {
|
||||
this._sendMessage(this.messages, ` 🎶 List Lagu 2 🎶
|
||||
[🎵]/lagu asal kau bahagia
|
||||
[🎵]/lagu canon rock
|
||||
[🎵]/lagu closer
|
||||
[🎵]/lagu dusk till dawn
|
||||
[🎵]/lagu rockabye
|
||||
[🎵]/lagu shape of you
|
||||
[🎵]/lagu perfect
|
||||
[🎵]/lagu hilang
|
||||
[🎵]/lagu salah`);
|
||||
}
|
||||
|
||||
gift() {
|
||||
this._sendMessage(this.messages, ` 🎁 STICKER 🎁
|
||||
|
||||
[🎉]Gift sticker 1
|
||||
[🎉]Gift sticker 2
|
||||
[🎉]Gift sticker 3
|
||||
[🎉]Gift sticker 4
|
||||
|
||||
🎁 THEMA 🎁
|
||||
|
||||
[🎉]Gift tema 1
|
||||
[🎉]Gift tema 2
|
||||
[🎉]Gift tema 3
|
||||
[🎉]Gift tema 4`);
|
||||
}
|
||||
|
||||
|
||||
async checkIG() {
|
||||
try {
|
||||
let { userProfile, userName, bio, media, follow } = await this._searchInstagram(this.payload[0]);
|
||||
await this._sendFileByUrl(this.messages,userProfile);
|
||||
await this._sendMessage(this.messages, `${userName}\n\nBIO:\n${bio}\n\n\uDBC0 ${follow} \uDBC0`)
|
||||
if(Array.isArray(media)) {
|
||||
for (let i = 0; i < media.length; i++) {
|
||||
await this._sendFileByUrl(this.messages,media[i]);
|
||||
}
|
||||
} else {
|
||||
this._sendMessage(this.messages,media);
|
||||
}
|
||||
} catch (error) {
|
||||
this._sendMessage(this.messages,`Error: ${error}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Command;
|
29
src/config.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
const { hostname, platform } = require('os');
|
||||
|
||||
const whichPlatform = platform() === 'darwin' ? 'MAC' : 'win32';
|
||||
|
||||
const config = {
|
||||
LINE_DOMAIN: 'gfs.line.naver.jp',
|
||||
// LINE_DOMAIN: 'gd2.line.naver.jp',
|
||||
LINE_OS_URL: 'os.line.naver.jp',
|
||||
LINE_HTTP_URL: '/api/v4/TalkService.do',
|
||||
LINE_STICKER_URL: 'dl.stickershop.line.naver.jp/products/',
|
||||
LINE_POLL_URL: '/P3',
|
||||
LINE_COMMAND_PATH: '/S3',
|
||||
LINE_CERTIFICATE_URL: '/Q',
|
||||
LINE_SHOP_PATH: '/SHOP4',
|
||||
LINE_SESSION_LINE_URL: '/authct/v1/keys/line',
|
||||
LINE_SESSION_NAVER_URL: '/authct/v1/keys/naver',
|
||||
LINE_POST_CONTENT_URL: 'https://os.line.naver.jp/talk/m/upload.nhn',
|
||||
ip: '127.0.0.1',
|
||||
version: '0.0.2',
|
||||
revision: 0,
|
||||
hostname: hostname(),
|
||||
platform: whichPlatform,
|
||||
EMAIL_REGEX: /[^@]+@[^@]+\.[^@]+/,
|
||||
Headers: {
|
||||
'User-Agent':'Alfath Dirk'
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config;
|
77
src/connect.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
const LineAPI = require('./api');
|
||||
|
||||
class LineConnect extends LineAPI {
|
||||
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
if (typeof options !== 'undefined') {
|
||||
this.authToken = options.authToken;
|
||||
this.certificate = options.certificate;
|
||||
this.config.Headers['X-Line-Access'] = options.authToken;
|
||||
}
|
||||
}
|
||||
|
||||
getQrFirst() {
|
||||
return new Promise((resolve,reject) => {
|
||||
this._qrCodeLogin().then(async (res) => {
|
||||
this.authToken = res.authToken;
|
||||
this.certificate = res.certificate;
|
||||
console.info(`[*] Token: ${this.authToken}`);
|
||||
console.info(`[*] Certificate: ${res.certificate}\n`);
|
||||
let { mid, displayName } = await this._client.getProfile();
|
||||
console.info(`[*] mid: ${mid}\n`);
|
||||
console.info(`[*] Name: ${displayName}\n`);
|
||||
console.info(`NOTE: Dont forget , put your mid and admin on variable 'myBot' in main.js \n`);
|
||||
console.info(`Regrads Alfathdirk and thx for TCR Team \n`);
|
||||
console.info(`=======BOT RUNNING======\n`);
|
||||
await this._tokenLogin(this.authToken, this.certificate);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async startx () {
|
||||
if (typeof this.authToken != 'undefined'){
|
||||
await this._tokenLogin(this.authToken, this.certificate);
|
||||
this._client.removeAllMessages(); //Fix Chat Spam When Bot Started (This bug only appears when u are login using authToken)
|
||||
return this.longpoll();
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.getQrFirst().then(async (res) => {
|
||||
resolve(this.longpoll());
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fetchOps(rev) {
|
||||
return this._fetchOps(rev, 1);
|
||||
}
|
||||
|
||||
fetchOperations(rev) {
|
||||
return this._fetchOperations(rev, 5);
|
||||
|
||||
}
|
||||
|
||||
longpoll() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._fetchOps(this.revision, 1).then((operations) => {
|
||||
if (!operations) {
|
||||
console.log('No operations');
|
||||
reject('No operations');
|
||||
return;
|
||||
}
|
||||
return operations.map((operation) => {
|
||||
if(operation.revision.toString() != -1) {
|
||||
let revisionNum = operation.revision.toString();
|
||||
resolve({ revisionNum, operation });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = LineConnect;
|
1108
src/main.js
Normal file
26
src/pinVerifier.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const utf8 = require('utf8');
|
||||
const RSA = require('node-bignumber');
|
||||
|
||||
class PinVerifier {
|
||||
constructor(id, password) {
|
||||
this.id = id;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
getRSACrypto(json) {
|
||||
const rsa = new RSA.Key();
|
||||
const chr = String.fromCharCode;
|
||||
const sessionKey = json.sessionKey;
|
||||
const message =
|
||||
utf8.encode(chr(sessionKey.length) +
|
||||
sessionKey + chr(this.id.length) +
|
||||
this.id + chr(this.password.length) + this.password);
|
||||
rsa.setPublic(json.nvalue, json.evalue);
|
||||
const credentials = rsa.encrypt(message).toString('hex');
|
||||
const keyname = json.keynm;
|
||||
return { keyname, credentials, message };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = PinVerifier;
|