├── .gitignore ├── LICENSE ├── README.md └── x.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Taisei@memochang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Line-Bot-x.py 2 | このソースはLINE民学習用ソースです。好きにしてもらって構いません。Adpが翻訳したものだと伝えられています。 3 | 4 | This is a source for learning LINE people. You can do whatever you want. It is reportedly translated by Adp. 5 | -------------------------------------------------------------------------------- /x.py: -------------------------------------------------------------------------------- 1 | # -*-coding: utf-8 -*- 2 | 3 | from linepy import * 4 | from datetime import datetime 5 | from time import sleep 6 | from humanfriendly import format_timespan, format_size, format_number, format_length 7 | import time, random, sys, json, codecs, threading, glob, re, string, os, requests, subprocess, six, ast, pytz, qrcode, urllib, urllib.parse, timeit 8 | #==============================================================================# 9 | botStart = time.time() 10 | 11 | cl = LINE() 12 | cl.log("Auth Token : " + str(cl.authToken)) 13 | 14 | clMID = cl.profile.mid 15 | 16 | clProfile = cl.getProfile() 17 | mid = cl.getProfile().mid 18 | lineSettings = cl.getSettings() 19 | 20 | oepoll = OEPoll(cl) 21 | #==============================================================================# 22 | readOpen = codecs.open("read.json","r","utf-8") 23 | settingsOpen = codecs.open("temp.json","r","utf-8") 24 | banOpen = codecs.open("ban.json","r","utf-8") 25 | 26 | read = json.load(readOpen) 27 | settings = json.load(settingsOpen) 28 | ban = json.load(banOpen) 29 | 30 | msg_dict = {} 31 | bl = [""] 32 | 33 | #==============================================================================# 34 | def restartBot(): 35 | print ("[ INFO ] BOT RESETTED") 36 | python = sys.executable 37 | os.execl(python, python, *sys.argv) 38 | def logError(text): 39 | cl.log("[ ERROR ] " + str(text)) 40 | time_ = datetime.now() 41 | with open("errorLog.txt","a") as error: 42 | error.write("\n[%s] %s" % (str(time), text)) 43 | def sendMessageWithMention(to, mid): 44 | try: 45 | aa = '{"S":"0","E":"3","M":'+json.dumps(mid)+'}' 46 | text_ = '@! ' 47 | cl.sendMessage(to, text_, contentMetadata={'MENTION':'{"MENTIONEES":['+aa+']}'}, contentType=0) 48 | except Exception as error: 49 | logError(error) 50 | def helpmessage(): 51 | helpMessage = """╔══════════════ 52 | ╠♥ ✿✿✿ 半Bot垢 ✿✿✿ ♥ 53 | ║ 54 | ╠══✪〘 Help Message 〙✪═══ 55 | ║ 56 | ╠✪〘 Help 〙✪══════════ 57 | ╠➥ help コマンドを文字で出します。 58 | ╠➥ ヘルプ コマンドをファイルで出します。 59 | ║ 60 | ╠✪〘 Status 〙✪════════ 61 | ╠➥ 詳細 詳細を確認します。 62 | ╠➥ 稼働時間 動作時間を確認します。 63 | ╠➥ Speed 処理速度をはかります。 64 | ╠➥ 設定確認 BOTの設定を確認します。 65 | ╠➥ ログアウト ログアウトします。 66 | ╠➥ テスト 正常に動作しているか確認します。 67 | ╠➥ 作者 BOTの作者をだすよ 68 | ╠➥ 利用規約 利用規約を出します。 69 | ║ 70 | ╠✪〘 Settings 〙✪═══════ 71 | ╠➥ 自動追加 オン/オフ 友達を自動で追加します。 72 | ╠➥ 自動参加 オン/オフ グループに自動で参加します。 73 | ╠➥ 自動退出 オン/オフ グループを自動で退出します。 74 | ╠➥ 自動既読 オン/オフ 自動で既読します。 75 | ║ 76 | ╠➥ 全保護 オン/オフ 全保護 77 | ╠➥ 蹴り保護 オン/オフ 蹴り保護 78 | ╠➥ うらる保護 オン/オフ URL保護 79 | ╠➥ 招待保護 オン/オフ 招待保護 80 | ║ 81 | ╠➥ mid取得 オン/オフ midを取得します。 82 | ╠➥ 復元 オン/オフ 消去メッセージ読み込み 83 | ╠➥ メンション自動返信 オン/オフ メンション自動返信 84 | ╠➥ ノート オン/オフ ノート自動URl作成 85 | ╠➥ 共有 オン/オフ 共有自動URL作成 86 | ║ 87 | ╠✪〘 Self 〙✪═════════ 88 | ╠➥ Me 連絡先送信 89 | ╠➥ mid mid送信 90 | ╠➥ 名前 名前送信 91 | ╠➥ ステコメ ステメ送信 92 | ╠➥ トプ画 トプ画送信 93 | ╠➥ ホーム画 ホーム画送信 94 | ╠➥ 連絡先送信 @ 連絡先取得 95 | ╠➥ Mid @ mid取得 96 | ╠➥ 詳細取得 @ 詳細取得 97 | ║ 98 | ╠✪〘 Blacklist 〙✪═══════ 99 | ╠➥ ブラリス追加 @ ブラリス追加 100 | ╠➥ ブラリス削除 @ ブラリス削除 101 | ╠➥ ブラリス一覧 ブラックリストを名前で送信します。 102 | ╠➥ ブラリス一覧mid ブラックリストをmidで送信します。 103 | ╠➥ 全削除ブラリス ブラリス消去 104 | ╠➥ ブラリス排除 ブラリス蹴り 105 | ║ 106 | ╠✪〘 Group 〙✪════════ 107 | ╠➥ グル作成者 グル作成者の連絡先を表示します。 108 | ╠➥ グルID グルIDを表示します。 109 | ╠➥ グル名 グル名を表示します。 110 | ╠➥ グル画 グル画を表示します。 111 | ╠➥ うらる作成 グルURL取得 112 | ╠➥ うらる許可 うらるを許可します。 113 | ╠➥ うらる拒否 うらるを拒否します。 114 | ╠➥ グルリスト 入っているグループのリストを表示します。 115 | ╠➥ グルメンバー グルメンリスト 116 | ╠➥ グル詳細 グル詳細を表示します。 117 | ╠➥ Gn (文字) グル名変更 118 | ╠➥ Mk @ メンション蹴り 119 | ╠➥ Nk ネーム蹴り 120 | ╠➥ Zk ネーム空白蹴り 121 | ╠➥ 全蹴り 全蹴り 122 | ╠➥ Inv (mid) mid招待 123 | ╠➥ キャンセル 招待キャンセル 124 | ╠➥ Ri @ 蹴り招待 125 | ║ 126 | ╠✪〘 Special 〙✪═══════ 127 | ╠➥ 偽造 オン/オフ 偽造 128 | ╠➥ ※偽造=トークを真似して送信します。 129 | ╠➥ 偽造リスト 偽造リスト 130 | ╠➥ 偽造追加 @ 偽造追加 131 | ╠➥ 偽造削除 @ 偽造削除 132 | ║ 133 | ╠➥ 既読ポイントセット 既読ポイント設置 134 | ╠➥ 既読ポイント消去 既読ポイント消去 135 | ╠➥ 既読確認 既読ポイント確認 136 | ║ 137 | ╠➥ オールメンション 全メンション 138 | ╠➥ Zt 139 | ╠➥ Zm 140 | ╠➥ コピー @ プロフィールコピー 141 | ╠➥ 初期化 プロフィール初期化 142 | ╠➥ 全グル送信:text 全グル送信 143 | ╠➥ 全個チャ送信:text 全送信 144 | ║ 145 | ╠✪〘 Admin 〙✪═════════ 146 | ╠➥ 権限追加 @ 権限者追加 147 | ╠➥ 権限削除 @ 権限者削除 148 | ╠➥ 権限リスト 権限者リスト 149 | ║ 150 | ╠✪〘 Invite 〙✪════════ 151 | ╠➥ 招待者追加 @ 招待者追加 152 | ╠➥ 招待者削除 @ 招待者削除 153 | ╠➥ 招待者リスト 招待者リスト 154 | ╠➥ 入室 155 | ║ 156 | ╚═〘 Created By: 半BOT販売 〙""" 157 | return helpMessage 158 | 159 | wait = { 160 | "myProfile": { 161 | "displayName": "", 162 | "coverId": "", 163 | "pictureStatus": "", 164 | "statusMessage": "" 165 | }, 166 | } 167 | wait2 = { 168 | 'readPoint':{}, 169 | 'readMember':{}, 170 | 'setTime':{}, 171 | 'ROM':{} 172 | } 173 | setTime = {} 174 | setTime = wait2['setTime'] 175 | 176 | wait["myProfile"]["displayName"] = clProfile.displayName 177 | wait["myProfile"]["statusMessage"] = clProfile.statusMessage 178 | wait["myProfile"]["pictureStatus"] = clProfile.pictureStatus 179 | coverId = cl.getProfileDetail()["result"]["objectId"] 180 | wait["myProfile"]["coverId"] = coverId 181 | 182 | def cTime_to_datetime(unixtime): 183 | return datetime.datetime.fromtimestamp(int(str(unixtime)[:len(str(unixtime))-3])) 184 | 185 | admin =['u356f45dcbdd5261625061f9f26d2004a',clMID] 186 | owners = [""] 187 | #if clMID not in owners: 188 | # python = sys.executable 189 | # os.execl(python, python, *sys.argv) 190 | #==============================================================================# 191 | def lineBot(op): 192 | try: 193 | if op.type == 0: 194 | return 195 | if op.type == 5: 196 | print ("[ 5 ] NOTIFIED ADD CONTACT") 197 | if settings["autoAdd"] == True: 198 | cl.findAndAddContactsByMid(op.param1) 199 | cl.sendMessage(op.param1, "友達追加ありがとうございます!".format(str(cl.getContact(op.param1).displayName))) 200 | if op.type == 11: 201 | group = cl.getGroup(op.param1) 202 | contact = cl.getContact(op.param2) 203 | if settings["qrprotect"] == True: 204 | if op.param2 in admin or op.param2 in ban["bots"]: 205 | pass 206 | else: 207 | gs = cl.getGroup(op.param1) 208 | cl.kickoutFromGroup(op.param1,[op.param2]) 209 | gs.preventJoinByTicket = True 210 | cl.updateGroup(gs) 211 | if op.type == 13: 212 | print ("[ 13 ] NOTIFIED INVITE GROUP") 213 | if clMID in op.param3: 214 | group = cl.getGroup(op.param1) 215 | if settings["autoJoin"] == True: 216 | cl.acceptGroupInvitation(op.param1) 217 | elif settings["invprotect"] == True: 218 | if op.param2 in admin or op.param2 in ban["bots"]: 219 | pass 220 | else: 221 | cl.cancelGroupInvitation(op.param1,[op.param3]) 222 | else: 223 | group = cl.getGroup(op.param1) 224 | gInviMids = [] 225 | for z in group.invitee: 226 | if z.mid in ban["blacklist"]: 227 | gInviMids.append(z.mid) 228 | if gInviMids == []: 229 | pass 230 | else: 231 | cl.cancelGroupInvitation(op.param1, gInviMids) 232 | cl.sendMessage(op.param1,"ブラリスユーザーの為キャンセルしました。") 233 | if op.type == 17: 234 | if op.param2 in admin or op.param2 in ban["bots"]: 235 | return 236 | ginfo = str(cl.getGroup(op.param1).name) 237 | try: 238 | strt = int(3) 239 | akh = int(3) 240 | akh = akh + 8 241 | aa = """{"S":"""+json.dumps(str(strt))+""","E":"""+json.dumps(str(akh))+""","M":"""+json.dumps(op.param2)+"},""" 242 | aa = (aa[:int(len(aa)-1)]) 243 | cl.sendMessage(op.param1, "@wanping さんが参加しました!"+ginfo , contentMetadata={'MENTION':'{"MENTIONEES":['+aa+']}'}, contentType=0) 244 | except Exception as e: 245 | print(str(e)) 246 | if op.type == 19: 247 | msg = op.message 248 | chiya = [] 249 | chiya.append(op.param2) 250 | chiya.append(op.param3) 251 | cmem = cl.getContacts(chiya) 252 | zx = "" 253 | zxc = "" 254 | zx2 = [] 255 | xpesan ='警告!' 256 | for x in range(len(cmem)): 257 | xname = str(cmem[x].displayName) 258 | pesan = '' 259 | pesan2 = pesan+"@x が" 260 | xlen = str(len(zxc)+len(xpesan)) 261 | xlen2 = str(len(zxc)+len(pesan2)+len(xpesan)-1) 262 | zx = {'S':xlen, 'E':xlen2, 'M':cmem[x].mid} 263 | zx2.append(zx) 264 | zxc += pesan2 265 | text = xpesan+ zxc + "を蹴りました!" 266 | try: 267 | cl.sendMessage(op.param1, text, contentMetadata={'MENTION':str('{"MENTIONEES":'+json.dumps(zx2).replace(' ','')+'}')}, contentType=0) 268 | except: 269 | cl.sendMessage(op.param1,"Notified kick out from group") 270 | if op.param2 not in admin: 271 | if op.param2 in ban["bots"]: 272 | pass 273 | elif settings["protect"] == True: 274 | ban["blacklist"][op.param2] = True 275 | cl.kickoutFromGroup(op.param1,[op.param2]) 276 | cl.inviteIntoGroup(op.param1,[op.param3]) 277 | else: 278 | cl.sendMessage(op.param1,"") 279 | else: 280 | cl.sendMessage(op.param1,"") 281 | if op.type == 24: 282 | print ("[ 24 ] NOTIFIED LEAVE ROOM") 283 | if settings["autoLeave"] == True: 284 | cl.leaveRoom(op.param1) 285 | # if op.type == 25 : 286 | # if msg.toType ==2: 287 | # g = cl.getGroup(op.message.to) 288 | # print ("sended:".format(str(g.name)) + str(msg.text)) 289 | # else: 290 | # print ("sended:" + str(msg.text)) 291 | # if op.type == 26: 292 | # msg =op.message 293 | # pop = cl.getContact(msg._from) 294 | # print ("replay:"+pop.displayName + ":" + str(msg.text)) 295 | if op.type == 26 or op.type == 25: 296 | msg = op.message 297 | text = msg.text 298 | msg_id = msg.id 299 | receiver = msg.to 300 | sender = msg._from 301 | if msg.toType == 0: 302 | if sender != cl.profile.mid: 303 | to = sender 304 | else: 305 | to = receiver 306 | else: 307 | to = receiver 308 | if msg.contentType == 0: 309 | if text is None: 310 | return 311 | #==============================================================================# 312 | if sender in K0 or sender in owners: 313 | if text.lower() == 'help': 314 | helpMessage = helpmessage() 315 | cl.sendMessage(to, str(helpMessage)) 316 | cl.sendContact(to,"u356f45dcbdd5261625061f9f26d2004a") 317 | elif text.lower() == 'bye': 318 | cl.sendMessage(to,"ByeBye") 319 | cl.leaveGroup(msg.to) 320 | #==============================================================================# 321 | elif text.lower() == 'speed': 322 | start = time.time() 323 | cl.sendMessage(to, "計測中...") 324 | elapsed_time = time.time() - start 325 | cl.sendMessage(to,format(str(elapsed_time)) + "秒") 326 | elif text.lower() == 'ログアウト': 327 | cl.sendMessage(to, "ログアウト中...") 328 | time.sleep(5) 329 | cl.sendMessage(to, "ログアウトしました。\n再ログインしてください。") 330 | restartBot() 331 | elif text.lower() == '稼働時間': 332 | timeNow = time.time() 333 | runtime = timeNow - botStart 334 | runtime = format_timespan(runtime) 335 | cl.sendMessage(to, "動作時間: {}".format(str(runtime))) 336 | elif text.lower() == '詳細': 337 | try: 338 | arr = [] 339 | owner ="u356f45dcbdd5261625061f9f26d2004a" 340 | creator = cl.getContact(owner) 341 | contact = cl.getContact(clMID) 342 | grouplist = cl.getGroupIdsJoined() 343 | contactlist = cl.getAllContactIds() 344 | blockedlist = cl.getBlockedContactIds() 345 | ret_ = "╔══[ 半BOT販売垢 ]" 346 | ret_ += "\n╠ 使用者 : {}".format(contact.displayName) 347 | ret_ += "\n╠ 参加グル : {}".format(str(len(grouplist))) 348 | ret_ += "\n╠ 友達 : {}".format(str(len(contactlist))) 349 | ret_ += "\n╠ ブロック : {}".format(str(len(blockedlist))) 350 | ret_ += "\n╠══[ Adp半bot ]" 351 | ret_ += "\n╠ バージョン : β2.2 試用バージョン" 352 | ret_ += "\n╠ 製作者 : {}".format(creator.displayName) 353 | ret_ += "\n╚══[ ご使用ありがとうございます ]" 354 | cl.sendMessage(to, str(ret_)) 355 | except Exception as e: 356 | cl.sendMessage(msg.to, str(e)) 357 | #==============================================================================# 358 | elif text.lower() == '設定確認': 359 | try: 360 | ret_ = "╔══[ 設定状態 ]" 361 | if settings["autoAdd"] == True: ret_ += "\n╠ 自動追加 ✅" 362 | else: ret_ += "\n╠ 自動追加 ❌" 363 | if settings["autoJoin"] == True: ret_ += "\n╠ 自動参加 ✅" 364 | else: ret_ += "\n╠ 自動参加 ❌" 365 | if settings["autoLeave"] == True: ret_ += "\n╠ 強制自動退出 ✅" 366 | else: ret_ += "\n╠ 強制自動退出 ❌" 367 | if settings["autoRead"] == True: ret_ += "\n╠ 自動既読 ✅" 368 | else: ret_ += "\n╠ 自動既読 ❌" 369 | if settings["protect"] ==True: ret_+="\n╠ 蹴り保護 ✅" 370 | else: ret_ += "\n╠ 蹴り保護 ❌" 371 | if settings["qrprotect"] ==True: ret_+="\n╠ URL保護 ✅" 372 | else: ret_ += "\n╠ URL保護 ❌" 373 | if settings["invprotect"] ==True: ret_+="\n╠ 招待保護 ✅" 374 | else: ret_ += "\n╠ 招待保護 ❌" 375 | if settings["detectMention"] ==True: ret_+="\n╠ メンション自動返信 ✅" 376 | else: ret_ += "\n╠ メンション自動返信 ❌" 377 | if settings["reread"] ==True: ret_+="\n╠ 消去メッセージ読み込み ✅" 378 | else: ret_ += "\n╠ 消去メッセージ読み込み ❌" 379 | if settings["share"] ==True: ret_+="\n╠ 共有自動URL作成 ✅" 380 | else: ret_ += "\n╠ 共有自動URL作成 ❌" 381 | ret_ += "\n╚══[ Finish ]" 382 | cl.sendMessage(to, str(ret_)) 383 | except Exception as e: 384 | cl.sendMessage(msg.to, str(e)) 385 | elif text.lower() == '自動追加 オン': 386 | settings["autoAdd"] = True 387 | cl.sendMessage(to, "自動追加をオンにしました!") 388 | elif text.lower() == '自動追加 オフ': 389 | settings["autoAdd"] = False 390 | cl.sendMessage(to, "自動追加をオフにしました!") 391 | elif text.lower() == '自動参加 オン': 392 | settings["autoJoin"] = True 393 | cl.sendMessage(to, "自動参加をオンにしました!") 394 | elif text.lower() == '自動参加 オフ': 395 | settings["autoJoin"] = False 396 | cl.sendMessage(to, "自動参加をオフにしました!") 397 | elif text.lower() == '自動退出 オン': 398 | settings["autoLeave"] = True 399 | cl.sendMessage(to, "強制自動退出をオンにしました!") 400 | elif text.lower() == '自動退出 オフ': 401 | settings["autoLeave"] = False 402 | cl.sendMessage(to, "強制自動退出をオフにしました!") 403 | elif text.lower() == '自動既読 オン': 404 | settings["autoRead"] = True 405 | cl.sendMessage(to, "自動既読をオンにしました!") 406 | elif text.lower() == '自動既読 オフ': 407 | settings["autoRead"] = False 408 | cl.sendMessage(to, "自動既読をオフにしました!") 409 | elif text.lower() == '復元 オン': 410 | settings["reread"] = True 411 | cl.sendMessage(to,"消去メッセージ読み込みをオンにしました!") 412 | elif text.lower() == '復元 オフ': 413 | settings["reread"] = False 414 | cl.sendMessage(to,"消去メッセージ読み込みをオフにしました!") 415 | elif text.lower() == '蹴り保護 オン': 416 | settings["protect"] = True 417 | cl.sendMessage(to, "蹴り保護オンにしました!") 418 | elif text.lower() == '蹴り保護 オフ': 419 | settings["protect"] = False 420 | cl.sendMessage(to, "蹴り保護オフにしました!") 421 | elif text.lower() == '共有 オン': 422 | settings["share"] = True 423 | cl.sendMessage(to, "共有自動URL作成オン") 424 | elif text.lower() == '共有 オフ': 425 | settings["share"] = False 426 | cl.sendMessage(to, "共有自動URL作成オフ") 427 | elif text.lower() == 'メンション自動返信 オン': 428 | settings["detectMention"] = True 429 | cl.sendMessage(to, "メンション自動返信をオンにしました!") 430 | elif text.lower() == 'メンション自動返信 オフ': 431 | settings["detectMention"] = False 432 | cl.sendMessage(to, "メンション自動返信をオフにしました!") 433 | elif text.lower() == 'うらる保護 オン': 434 | settings["qrprotect"] = True 435 | cl.sendMessage(to, "うらる保護オンにしました!") 436 | elif text.lower() == 'うらる保護 オフ': 437 | settings["qrprotect"] = False 438 | cl.sendMessage(to, "うらる保護オフにしました!") 439 | elif text.lower() == '招待保護 オン': 440 | settings["invprotect"] = True 441 | cl.sendMessage(to, "招待保護をオンにしました!") 442 | elif text.lower() == '招待保護 オフ': 443 | settings["invprotect"] = False 444 | cl.sendMessage(to, "招待保護をオフにしました!") 445 | elif text.lower() == 'mid取得 オン': 446 | settings["getmid"] = True 447 | cl.sendMessage(to, "mid取得をオンにしました!") 448 | elif text.lower() == 'mid取得 オフ': 449 | settings["getmid"] = False 450 | cl.sendMessage(to, "mid取得をオフにしました!") 451 | elif text.lower() == 'ノート オン': 452 | settings["note"] = True 453 | cl.sendMessage(to, "ノート自動URL作成オン") 454 | elif text.lower() == 'ノート オフ': 455 | settings["note"] = False 456 | cl.sendMessage(to, "ノート自動URL作成オフ") 457 | elif text.lower() == '全保護 オン': 458 | settings["protect"] = True 459 | settings["qrprotect"] = True 460 | settings["invprotect"] = True 461 | cl.sendMessage(to, "蹴り、URL、招待保護をオンにしました") 462 | elif text.lower() == '作者': 463 | cl.sendMessage(msg.to,"こちらが作者だよ。") 464 | cl.sendContact(to,"u356f45dcbdd5261625061f9f26d2004a") 465 | if text.lower() == 'ヘルプ': 466 | cl.sendFile(to,"help.py") 467 | cl.sendContact(to,"u356f45dcbdd5261625061f9f26d2004a") 468 | 469 | elif text.lower() == '利用規約': 470 | cl.sendMessage(to, "利用規約および関連法規1.このBOTは有料半BOT4です。2.有料半BOTはログアウトしてしまったら何度でもログインできますので、ご安心ください。3.尚、半BOTはLINEの規約違反ですので、規制に掛かるこも稀にあります。ですが、こちらは責任は取りませんので、ご了承ください。4.規制についてはこちらも改善して行きます。m(_ _)m 5.もしログアウトしてしまったら下の連絡先又は半BOTグループなどで、再ログインできます。ご安心ください。m(_ _)m 6.このBOTの処理速度は0.01〜0.03前後です。ご確認ください。────以上が利用規約および関連法規でした。────") 471 | cl.sendContact(to,"u356f45dcbdd5261625061f9f26d2004a") 472 | elif text.lower() == '全保護 オフ': 473 | settings["protect"] = False 474 | settings["qrprotect"] = False 475 | settings["invprotect"] = False 476 | cl.sendMessage(to, "蹴り、URL、招待保護をオフにしました") 477 | #==============================================================================# 478 | elif msg.text.lower().startswith("権限追加 "): 479 | MENTION = eval(msg.contentMetadata['MENTION']) 480 | inkey = MENTION['MENTIONEES'][0]['M'] 481 | admin.append(str(inkey)) 482 | cl.sendMessage(to, "権限者を追加しました!") 483 | elif msg.text.lower().startswith("権限削除 "): 484 | MENTION = eval(msg.contentMetadata['MENTION']) 485 | inkey = MENTION['MENTIONEES'][0]['M'] 486 | admin.remove(str(inkey)) 487 | cl.sendMessage(to, "権限者を消去しました!") 488 | elif text.lower() == '権限リスト': 489 | if admin == ['u356f45dcbdd5261625061f9f26d2004a']: 490 | cl.sendMessage(to,"権限者はいません!") 491 | else: 492 | mc = "╔══[ Admin List ]" 493 | for mi_d in admin: 494 | mc += "\n╠ "+cl.getContact(mi_d).displayName 495 | cl.sendMessage(to,mc + "\n╚══[ Finish ]") 496 | elif msg.text.lower().startswith("invite "): 497 | targets = [] 498 | key = eval(msg.contentMetadata["MENTION"]) 499 | key["MENTIONEES"][0]["M"] 500 | for x in key["MENTIONEES"]: 501 | targets.append(x["M"]) 502 | G = cl.getGroup 503 | cl.inviteIntoGroup(to,targets) 504 | elif ("Say " in msg.text): 505 | x = text.split(' ',2) 506 | c = int(x[2]) 507 | for c in range(c): 508 | cl.sendMessage(to,x[1]) 509 | elif msg.text.lower().startswith("tag "): 510 | MENTION = eval(msg.contentMetadata['MENTION']) 511 | inkey = MENTION['MENTIONEES'][0]['M'] 512 | x = text.split(' ',2) 513 | c = int(x[2]) 514 | for c in range(c): 515 | sendMessageWithMention(to, inkey) 516 | elif msg.text.lower().startswith("招待者追加 "): 517 | MENTION = eval(msg.contentMetadata['MENTION']) 518 | inkey = MENTION['MENTIONEES'][0]['M'] 519 | ban["bots"].append(str(inkey)) 520 | cl.sendMessage(to, "招待者を追加しました!") 521 | elif msg.text.lower().startswith("招待者削除 "): 522 | MENTION = eval(msg.contentMetadata['MENTION']) 523 | inkey = MENTION['MENTIONEES'][0]['M'] 524 | ban["bots"].remove(str(inkey)) 525 | cl.sendMessage(to, "招待者を削除しました!") 526 | elif text.lower() == '招待者リスト': 527 | if ban["bots"] == []: 528 | cl.sendMessage(to,"招待者はいません!") 529 | else: 530 | mc = "╔══[ Inviter List ]" 531 | for mi_d in ban["bots"]: 532 | mc += "\n╠ "+cl.getContact(mi_d).displayName 533 | cl.sendMessage(to,mc + "\n╚══[ Finish ]") 534 | elif text.lower() == '入室': 535 | if msg.toType == 2: 536 | G = cl.getGroup 537 | cl.inviteIntoGroup(to,ban["bots"]) 538 | elif msg.text.lower().startswith("ii "): 539 | MENTION = eval(msg.contentMetadata['MENTION']) 540 | inkey = MENTION['MENTIONEES'][0]['M'] 541 | cl.createGroup("fuck",[inkey]) 542 | cl.leaveGroup(op.param1) 543 | #==============================================================================# 544 | elif text.lower() == 'me': 545 | if msg.toType == 2 or msg.toType == 1: 546 | sendMessageWithMention(to, sender) 547 | cl.sendContact(to, sender) 548 | else: 549 | cl.sendContact(to,sender) 550 | elif text.lower() == 'mid': 551 | cl.sendMessage(msg.to,"[MID]\n" + sender) 552 | elif text.lower() == '名前': 553 | me = cl.getContact(sender) 554 | cl.sendMessage(msg.to,"[Name]\n" + me.displayName) 555 | elif text.lower() == 'ステコメ': 556 | me = cl.getContact(sender) 557 | cl.sendMessage(msg.to,"[StatusMessage]\n" + me.statusMessage) 558 | elif text.lower() == 'トプ画': 559 | me = cl.getContact(sender) 560 | cl.sendImageWithURL(msg.to,"http://dl.profile.line-cdn.net/" + me.pictureStatus) 561 | elif text.lower() == 'myvideoprofile': 562 | me = cl.getContact(sender) 563 | cl.sendVideoWithURL(msg.to,"http://dl.profile.line-cdn.net/" + me.pictureStatus + "/vp") 564 | elif text.lower() == 'ホーム画': 565 | me = cl.getContact(sender) 566 | cover = cl.getProfileCoverURL(sender) 567 | cl.sendImageWithURL(msg.to, cover) 568 | elif msg.text in ["テスト"]: 569 | cl.sendMessage(msg.to,"正常に動作しています。") 570 | elif msg.text.lower().startswith("連絡先送信 "): 571 | if 'MENTION' in msg.contentMetadata.keys()!= None: 572 | names = re.findall(r'@(\w+)', text) 573 | mention = ast.literal_eval(msg.contentMetadata['MENTION']) 574 | mentionees = mention['MENTIONEES'] 575 | lists = [] 576 | for mention in mentionees: 577 | if mention["M"] not in lists: 578 | lists.append(mention["M"]) 579 | for ls in lists: 580 | contact = cl.getContact(ls) 581 | mi_d = contact.mid 582 | cl.sendContact(msg.to, mi_d) 583 | elif msg.text.lower().startswith("mid "): 584 | if 'MENTION' in msg.contentMetadata.keys()!= None: 585 | names = re.findall(r'@(\w+)', text) 586 | mention = ast.literal_eval(msg.contentMetadata['MENTION']) 587 | mentionees = mention['MENTIONEES'] 588 | lists = [] 589 | for mention in mentionees: 590 | if mention["M"] not in lists: 591 | lists.append(mention["M"]) 592 | ret_ = "[ Mid User ]" 593 | for ls in lists: 594 | ret_ += "\n" + ls 595 | cl.sendMessage(msg.to, str(ret_)) 596 | elif msg.text.lower().startswith("詳細取得 "): 597 | if 'MENTION' in msg.contentMetadata.keys()!= None: 598 | names = re.findall(r'@(\w+)', text) 599 | mention = ast.literal_eval(msg.contentMetadata['MENTION']) 600 | mentionees = mention['MENTIONEES'] 601 | lists = [] 602 | for mention in mentionees: 603 | if mention["M"] not in lists: 604 | lists.append(mention["M"]) 605 | for ls in lists: 606 | contact = cl.getContact(ls) 607 | cl.sendMessage(msg.to, "[ 名前 ]\n" + contact.displayName) 608 | for ls in lists: 609 | contact = cl.getContact(ls) 610 | cl.sendMessage(msg.to, "[ ステメ ]\n" + contact.statusMessage) 611 | for mention in mentionees: 612 | if mention["M"] not in lists: 613 | lists.append(mention["M"]) 614 | for ls in lists: 615 | path = "http://dl.profile.line-cdn.net/" + cl.getContact(ls).pictureStatus 616 | cl.sendImageWithURL(msg.to, str(path)) 617 | if 'MENTION' in msg.contentMetadata.keys()!= None: 618 | names = re.findall(r'@(\w+)', text) 619 | mention = ast.literal_eval(msg.contentMetadata['MENTION']) 620 | mentionees = mention['MENTIONEES'] 621 | lists = [] 622 | for mention in mentionees: 623 | if mention["M"] not in lists: 624 | lists.append(mention["M"]) 625 | for ls in lists: 626 | path = cl.getProfileCoverURL(ls) 627 | cl.sendImageWithURL(msg.to, str(path)) 628 | 629 | #==============================================================================# 630 | elif msg.text.lower().startswith("偽造追加 "): 631 | targets = [] 632 | key = eval(msg.contentMetadata["MENTION"]) 633 | key["MENTIONEES"][0]["M"] 634 | for x in key["MENTIONEES"]: 635 | targets.append(x["M"]) 636 | for target in targets: 637 | try: 638 | ban["mimic"]["target"][target] = True 639 | cl.sendMessage(msg.to,"偽造に追加しました!") 640 | break 641 | except: 642 | cl.sendMessage(msg.to,"偽造追加に失敗しました!") 643 | break 644 | elif msg.text.lower().startswith("偽造削除 "): 645 | targets = [] 646 | key = eval(msg.contentMetadata["MENTION"]) 647 | key["MENTIONEES"][0]["M"] 648 | for x in key["MENTIONEES"]: 649 | targets.append(x["M"]) 650 | for target in targets: 651 | try: 652 | del settings["模仿名單"]["target"][target] 653 | cl.sendMessage(msg.to,"偽造から削除しました!") 654 | break 655 | except: 656 | cl.sendMessage(msg.to,"偽造削除に失敗しました!") 657 | break 658 | elif text.lower() == '偽造リスト': 659 | if ban["mimic"]["target"] == {}: 660 | cl.sendMessage(msg.to,"偽造はいません!") 661 | else: 662 | mc = "╔══[ Mimic List ]" 663 | for mi_d in ban["mimic"]["target"]: 664 | mc += "\n╠ "+cl.getContact(mi_d).displayName 665 | cl.sendMessage(msg.to,mc + "\n╚══[ Finish ]") 666 | elif "偽造" in msg.text.lower(): 667 | sep = text.split(" ") 668 | mic = text.replace(sep[0] + " ","") 669 | if mic == "オン": 670 | if ban["mimic"]["status"] == False: 671 | ban["mimic"]["status"] = True 672 | cl.sendMessage(msg.to,"偽造をオンにしました。") 673 | elif mic == "オフ": 674 | if ban["mimic"]["status"] == True: 675 | ban["mimic"]["status"] = False 676 | cl.sendMessage(msg.to,"偽造をオフにしました。") 677 | 678 | #==============================================================================# 679 | elif text.lower() == 'グル作成者': 680 | group = cl.getGroup(to) 681 | GS = group.creator.mid 682 | cl.sendContact(to, GS) 683 | elif text.lower() == 'グルID': 684 | gid = cl.getGroup(to) 685 | cl.sendMessage(to, "[ ID Group ]\n" + gid.id) 686 | elif text.lower() == 'グル画': 687 | group = cl.getGroup(to) 688 | path = "http://dl.profile.line-cdn.net/" + group.pictureStatus 689 | cl.sendImageWithURL(to, path) 690 | elif text.lower() == 'グル名': 691 | gid = cl.getGroup(to) 692 | cl.sendMessage(to, "[ グル名 ]\n" + gid.name) 693 | elif text.lower() == 'うらる作成': 694 | if msg.toType == 2: 695 | group = cl.getGroup(to) 696 | if group.preventedJoinByTicket == False: 697 | ticket = cl.reissueGroupTicket(to) 698 | cl.sendMessage(to, "[ Group Ticket ]\nline://ti/g/{}".format(str(ticket))) 699 | else: 700 | cl.sendMessage(to, "Grouplink未解放 {}openlink".format(str(settings["keyCommand"]))) 701 | cl.sendMessage(to, "URL参加をオンにしてください!") 702 | elif text.lower() == 'うらる許可': 703 | if msg.toType == 2: 704 | group = cl.getGroup(to) 705 | if group.preventedJoinByTicket == False: 706 | cl.sendMessage(to, "既にURL参加がオンです!") 707 | else: 708 | group.preventedJoinByTicket = False 709 | cl.updateGroup(group) 710 | cl.sendMessage(to, "URL参加をオンにしました!") 711 | elif text.lower() == 'うらる拒否': 712 | if msg.toType == 2: 713 | group = cl.getGroup(to) 714 | if group.preventedJoinByTicket == True: 715 | cl.sendMessage(to, "既にURL参加がオフです!") 716 | else: 717 | group.preventedJoinByTicket = True 718 | cl.updateGroup(group) 719 | cl.sendMessage(to, "URL参加をオフにしました!") 720 | elif text.lower() == 'グル詳細': 721 | group = cl.getGroup(to) 722 | try: 723 | gCreator = group.creator.displayName 724 | except: 725 | gCreator = "不明" 726 | if group.invitee is None: 727 | gPending = "0" 728 | else: 729 | gPending = str(len(group.invitee)) 730 | if group.preventedJoinByTicket == True: 731 | gQr = "URL参加オフ" 732 | gTicket = "無し" 733 | else: 734 | gQr = "URL参加オン" 735 | gTicket = "line://ti/g/{}".format(str(cl.reissueGroupTicket(group.id))) 736 | path = "http://dl.profile.line-cdn.net/" + group.pictureStatus 737 | ret_ = "╔══[ Group Info ]" 738 | ret_ += "\n╠ グル名 : {}".format(str(group.name)) 739 | ret_ += "\n╠ グルId : {}".format(group.id) 740 | ret_ += "\n╠ 作成者 : {}".format(str(gCreator)) 741 | ret_ += "\n╠ グル人数 : {}".format(str(len(group.members))) 742 | ret_ += "\n╠ 招待人数 : {}".format(gPending) 743 | ret_ += "\n╠ URL開閉 : {}".format(gQr) 744 | ret_ += "\n╠ 参加URL : {}".format(gTicket) 745 | ret_ += "\n╚══[ Finish ]" 746 | cl.sendMessage(to, str(ret_)) 747 | cl.sendImageWithURL(to, path) 748 | elif text.lower() == 'グルメンバー': 749 | if msg.toType == 2: 750 | group = cl.getGroup(to) 751 | ret_ = "╔══[ グルメン ]" 752 | no = 0 + 1 753 | for mem in group.members: 754 | ret_ += "\n╠ {}. {}".format(str(no), str(mem.displayName)) 755 | no += 1 756 | ret_ += "\n╚══[ 参加者: {} 人]".format(str(len(group.members))) 757 | cl.sendMessage(to, str(ret_)) 758 | elif text.lower() == 'グルリスト': 759 | groups = cl.groups 760 | ret_ = "╔══[ 参加グルリスト ]" 761 | no = 0 + 1 762 | for gid in groups: 763 | group = cl.getGroup(gid) 764 | ret_ += "\n╠ {}. {} | {}".format(str(no), str(group.name), str(len(group.members))) 765 | no += 1 766 | ret_ += "\n╚══[ 合計: {} グル ]".format(str(len(groups))) 767 | cl.sendMessage(to, str(ret_)) 768 | elif msg.text.lower().startswith("Mk "): 769 | targets = [] 770 | key = eval(msg.contentMetadata["MENTION"]) 771 | key["MENTIONEES"][0]["M"] 772 | for x in key["MENTIONEES"]: 773 | targets.append(x["M"]) 774 | for target in targets: 775 | try: 776 | #cl.sendMessage(to,"Fuck you") 777 | cl.kickoutFromGroup(msg.to,[target]) 778 | except: 779 | cl.sendMessage(to,"Error") 780 | elif "Nk" in msg.text: 781 | Nk0 = msg.text.replace("Nk ", "") 782 | Nk1 = Nk0.lstrip() 783 | Nk2 = Nk1.replace("@", "") 784 | Nk3 = Nk2.rstrip() 785 | _name = Nk3 786 | gs = cl.getGroup(msg.to) 787 | targets = [] 788 | for s in gs.members: 789 | if _name in s.displayName: 790 | targets.append(s.mid) 791 | if targets == []: 792 | cl.sendMessage(msg.to, "ユーザーが存在しません。") 793 | pass 794 | else: 795 | targets.remove(mid) 796 | for s in whitelist: 797 | if s in targets: 798 | targets.remove(s) 799 | for target in targets: 800 | try: 801 | cl.kickoutFromGroup(msg.to, [target]) 802 | except: 803 | cl.sendMessage(msg.to, "正常に処理できませんでした") 804 | elif "Zk" in msg.text: 805 | gs = cl.getGroup(to) 806 | targets = [] 807 | for g in gs.members: 808 | if g.displayName in "": 809 | targets.append(g.mid) 810 | if targets == []: 811 | pass 812 | else: 813 | for target in targets: 814 | if target in admin: 815 | pass 816 | else: 817 | try: 818 | cl.kickoutFromGroup(to,[target]) 819 | except: 820 | cl.sendMessage(msg.to, "正常に処理できませんでした") 821 | 822 | elif msg.text.lower().startswith("ri "): 823 | targets = [] 824 | key = eval(msg.contentMetadata["MENTION"]) 825 | key["MENTIONEES"][0]["M"] 826 | for x in key["MENTIONEES"]: 827 | targets.append(x["M"]) 828 | for target in targets: 829 | try: 830 | cl.sendMessage(to,"蹴り後、招待します!") 831 | cl.kickoutFromGroup(msg.to,[target]) 832 | cl.inviteIntoGroup(to,[target]) 833 | except: 834 | cl.sendMessage(to,"Error") 835 | elif text.lower() == '全蹴り': 836 | if msg.toType == 2: 837 | print ("[ 19 ] KICK ALL MEMBER") 838 | _name = msg.text.replace("全蹴り","") 839 | gs = cl.getGroup(msg.to) 840 | cl.sendMessage(msg.to,"全蹴り実行!") 841 | targets = [] 842 | for g in gs.members: 843 | if _name in g.displayName: 844 | targets.append(g.mid) 845 | if targets == []: 846 | cl.sendMessage(msg.to,"Error") 847 | else: 848 | for target in targets: 849 | try: 850 | cl.kickoutFromGroup(msg.to,[target]) 851 | print (msg.to,[g.mid]) 852 | except: 853 | cl.sendMessage(msg.to,"") 854 | elif ("Gn " in msg.text): 855 | if msg.toType == 2: 856 | X = cl.getGroup(msg.to) 857 | X.name = msg.text.replace("Gn ","") 858 | cl.updateGroup(X) 859 | else: 860 | cl.sendMessage(msg.to,"グループ以外には使用できません。") 861 | elif text.lower() == 'キャンセル': 862 | if msg.toType == 2: 863 | group = cl.getGroup(to) 864 | gMembMids = [contact.mid for contact in group.invitee] 865 | for _mid in gMembMids: 866 | cl.cancelGroupInvitation(msg.to,[_mid]) 867 | cl.sendMessage(msg.to,"招待中をキャンセルしました!") 868 | elif ("Inv " in msg.text): 869 | if msg.toType == 2: 870 | midd = msg.text.replace("Inv ","") 871 | cl.findAndAddContactsByMid(midd) 872 | cl.inviteIntoGroup(to,[midd]) 873 | #==============================================================================# 874 | elif text.lower() == 'オールメンション': 875 | group = cl.getGroup(msg.to) 876 | nama = [contact.mid for contact in group.members] 877 | k = len(nama)//100 878 | for a in range(k+1): 879 | txt = u'' 880 | s=0 881 | b=[] 882 | for i in group.members[a*100 : (a+1)*100]: 883 | b.append({"S":str(s), "E" :str(s+6), "M":i.mid}) 884 | s += 7 885 | txt += u'@Alin \n' 886 | cl.sendMessage(to, text=txt, contentMetadata={u'MENTION': json.dumps({'MENTIONEES':b})}, contentType=0) 887 | cl.sendMessage(to, "合計: {} メンション".format(str(len(nama)))) 888 | if "qr:" in text: 889 | try: 890 | a = text.replace('qr:','') 891 | img = qrcode.make(a) 892 | img.save('qr.png') 893 | cl.sendImage(to,"qe.png") 894 | os.remove('qr.png') 895 | except: 896 | cl.sendMessage(msg.to,"Error") 897 | elif text.lower() == 'zt': 898 | gs = cl.getGroup(to) 899 | targets = [] 900 | for g in gs.members: 901 | if g.displayName in "": 902 | targets.append(g.mid) 903 | if targets == []: 904 | pass 905 | else: 906 | for target in targets: 907 | sendMessageWithMention(to,target) 908 | elif text.lower() == 'zm': 909 | gs = cl.getGroup(to) 910 | targets = [] 911 | for g in gs.members: 912 | if g.displayName in "": 913 | targets.append(g.mid) 914 | if targets == []: 915 | pass 916 | else: 917 | for mi_d in targets: 918 | cl.sendContect(to,mi_d) 919 | elif text.lower() == '既読ポイントセット': 920 | cl.sendMessage(msg.to, "既読ポイントを設置しました!") 921 | try: 922 | del wait2['readPoint'][msg.to] 923 | del wait2['readMember'][msg.to] 924 | except: 925 | pass 926 | now2 = datetime.now() 927 | wait2['readPoint'][msg.to] = msg.id 928 | wait2['readMember'][msg.to] = "" 929 | wait2['setTime'][msg.to] = datetime.strftime(now2,"%H:%M") 930 | wait2['ROM'][msg.to] = {} 931 | elif text.lower() == "既読ポイント消去": 932 | cl.sendMessage(to, "既読ポイントを消去しました!") 933 | try: 934 | del wait2['readPoint'][msg.to] 935 | del wait2['readMember'][msg.to] 936 | del wait2['setTime'][msg.to] 937 | except: 938 | pass 939 | elif msg.text in ["既読確認","Checkread"]: 940 | if msg.to in wait2['readPoint']: 941 | if wait2["ROM"][msg.to].items() == []: 942 | chiya = "" 943 | else: 944 | chiya = "" 945 | for rom in wait2["ROM"][msg.to].items(): 946 | chiya += rom[1] + "\n" 947 | cl.sendMessage(msg.to, "[既読]%s\n\n[無視]:\n%s\n設置時間:\n[%s]" % (wait2['readMember'][msg.to],chiya,setTime[msg.to])) 948 | else: 949 | cl.sendMessage(msg.to, "既読ポイントを設置してください!") 950 | 951 | #==============================================================================# 952 | elif msg.text.lower().startswith("ブラリス追加 "): 953 | targets = [] 954 | key = eval(msg.contentMetadata["MENTION"]) 955 | key["MENTIONEES"][0]["M"] 956 | for x in key["MENTIONEES"]: 957 | targets.append(x["M"]) 958 | for target in targets: 959 | try: 960 | ban["blacklist"][target] = True 961 | cl.sendMessage(msg.to,"ブラック追加しました!") 962 | break 963 | except: 964 | cl.sendMessage(msg.to,"ブラック追加に失敗しました!") 965 | break 966 | elif "Ban:" in msg.text: 967 | mmtxt = text.replace("Ban:","") 968 | try: 969 | ban["blacklist"][mmtext] = True 970 | cl.sendMessage(msg.to,"ブラック追加しました!") 971 | except: 972 | cl.sendMessage(msg.to,"ブラック追加に失敗しました!") 973 | elif msg.text.lower().startswith("ブラリス削除 "): 974 | targets = [] 975 | key = eval(msg.contentMetadata["MENTION"]) 976 | key["MENTIONEES"][0]["M"] 977 | for x in key["MENTIONEES"]: 978 | targets.append(x["M"]) 979 | for target in targets: 980 | try: 981 | del ban["blacklist"][target] 982 | cl.sendMessage(msg.to,"ブラック削除しました!") 983 | break 984 | except: 985 | cl.sendMessage(msg.to,"ブラック削除に失敗しました!") 986 | break 987 | elif text.lower() == 'ブラリス一覧': 988 | if ban["blacklist"] == {}: 989 | cl.sendMessage(msg.to,"ブラックはいません!") 990 | else: 991 | mc = "╔══[ Black List ]" 992 | for mi_d in ban["blacklist"]: 993 | mc += "\n╠ "+cl.getContact(mi_d).displayName 994 | cl.sendMessage(msg.to,mc + "\n╚══[ Finish ]") 995 | elif text.lower() == 'ブラリス排除': 996 | if msg.toType == 2: 997 | group = cl.getGroup(to) 998 | gMembMids = [contact.mid for contact in group.members] 999 | matched_list = [] 1000 | for tag in ban["blacklist"]: 1001 | matched_list+=filter(lambda str: str == tag, gMembMids) 1002 | if matched_list == []: 1003 | cl.sendMessage(msg.to,"ブラックはいません!") 1004 | return 1005 | for jj in matched_list: 1006 | cl.kickoutFromGroup(msg.to,[jj]) 1007 | cl.sendMessage(msg.to,"ブラックを蹴りました!") 1008 | elif text.lower() == '全削除ブラリス': 1009 | for mi_d in ban["blacklist"]: 1010 | ban["blacklist"] = {} 1011 | cl.sendMessage(to, "ブラックリストを消去しました!") 1012 | elif text.lower() == 'ブラリス一覧mid': 1013 | if ban["blacklist"] == {}: 1014 | cl.sendMessage(msg.to,"ブラックはいません!") 1015 | else: 1016 | mc = "╔══[ Black List ]" 1017 | for mi_d in ban["blacklist"]: 1018 | mc += "\n╠ "+mi_d 1019 | cl.sendMessage(to,mc + "\n╚══[ Finish ]") 1020 | 1021 | 1022 | #==============================================================================# 1023 | elif "全個チャ送信:" in msg.text: 1024 | bctxt = text.replace("全個チャ送信:","") 1025 | t = cl.getAllContactIds() 1026 | for manusia in t: 1027 | cl.sendMessage(manusia,(bctxt)) 1028 | elif "全グル送信:" in msg.text: 1029 | bctxt = text.replace("全グル送信:","") 1030 | n = cl.getGroupIdsJoined() 1031 | for manusia in n: 1032 | cl.sendMessage(manusia,(bctxt)) 1033 | elif "コピー " in msg.text: 1034 | targets = [] 1035 | key = eval(msg.contentMetadata["MENTION"]) 1036 | key["MENTIONEES"][0]["M"] 1037 | for x in key["MENTIONEES"]: 1038 | targets.append(x["M"]) 1039 | for target in targets: 1040 | try: 1041 | contact = cl.getContact(target) 1042 | X = contact.displayName 1043 | profile = cl.getProfile() 1044 | profile.displayName = X 1045 | cl.updateProfile(profile) 1046 | cl.sendMessage(to, "コピー中...") 1047 | Y = contact.statusMessage 1048 | lol = cl.getProfile() 1049 | lol.statusMessage = Y 1050 | cl.updateProfile(lol) 1051 | path = "http://dl.profile.line-cdn.net/" + contact.pictureStatus 1052 | P = contact.pictureStatus 1053 | cl.updateProfilePicture(P) 1054 | except Exception as e: 1055 | cl.sendMessage(to, "すべてのコピーが完了しました!") 1056 | 1057 | elif text.lower() == '初期化': 1058 | try: 1059 | lineProfile.displayName = str(myProfile["displayName"]) 1060 | lineProfile.statusMessage = str(myProfile["statusMessage"]) 1061 | lineProfile.pictureStatus = str(myProfile["pictureStatus"]) 1062 | cl.updateProfileAttribute(8, lineProfile.pictureStatus) 1063 | cl.updateProfile(lineProfile) 1064 | sendMention(msg.to, sender, "「 Restore Profile 」\nNama ", " \nBerhasil restore profile") 1065 | except: 1066 | cl.sendMessage(msg.to, "プロフィールを初期化しました!") 1067 | #==============================================================================# 1068 | if msg.contentType == 13: 1069 | if settings["getmid"] == True: 1070 | if 'displayName' in msg.contentMetadata: 1071 | contact = cl.getContact(msg.contentMetadata["mid"]) 1072 | cl.sendMessage(msg.to,"[mid]:\n" + msg.contentMetadata["mid"]) 1073 | else: 1074 | cl.sendMessage(msg.to,"[mid]:\n" + msg.contentMetadata["mid"]) 1075 | elif msg.contentType == 16: 1076 | if settings["note"] == True: 1077 | msg.contentType = 0 1078 | msg.text = "ノートが作成されました\n" + msg.contentMetadata["postEndUrl"] 1079 | # detail = cl.downloadFileURL(to,msg,msg.contentMetadata["postEndUrl"]) 1080 | cl.sendMessage(msg.to,msg.text) 1081 | #==============================================================================# 1082 | if op.type == 26: 1083 | msg = op.message 1084 | text = msg.text 1085 | msg_id = msg.id 1086 | receiver = msg.to 1087 | sender = msg._from 1088 | if msg.toType == 0: 1089 | if sender != cl.profile.mid: 1090 | to = sender 1091 | else: 1092 | to = receiver 1093 | else: 1094 | to = receiver 1095 | if settings["autoRead"] == True: 1096 | cl.sendChatChecked(to, msg_id) 1097 | if to in read["readPoint"]: 1098 | if sender not in read["ROM"][to]: 1099 | read["ROM"][to][sender] = True 1100 | if sender in ban["mimic"]["target"] and ban["mimic"]["status"] == True and ban["mimic"]["target"][sender] == True: 1101 | text = msg.text 1102 | if text is not None: 1103 | cl.sendMessage(msg.to,text) 1104 | if msg.contentType == 0 and sender not in clMID and msg.toType == 2: 1105 | if 'MENTION' in msg.contentMetadata.keys()!= None: 1106 | names = re.findall(r'@(\w+)', text) 1107 | mention = ast.literal_eval(msg.contentMetadata['MENTION']) 1108 | mentionees = mention['MENTIONEES'] 1109 | lists = [] 1110 | for mention in mentionees: 1111 | if clMID in mention["M"]: 1112 | if settings["detectMention"] == True: 1113 | contact = cl.getContact(sender) 1114 | sendMessageWithMention(to, contact.mid) 1115 | cl.sendMessage(to, "どうなされましたか?") 1116 | break 1117 | try: 1118 | msg = op.message 1119 | if settings["reread"] == True: 1120 | if msg.toType == 0: 1121 | cl.log("[%s]"%(msg._from)+msg.text) 1122 | else: 1123 | cl.log("[%s]"%(msg.to)+msg.text) 1124 | if msg.contentType == 0: 1125 | msg_dict[msg.id] = {"text":msg.text,"from":msg._from,"createdTime":msg.createdTime} 1126 | elif msg.contentType == 7: 1127 | stk_id = msg.contentMetadata['STKID'] 1128 | msg_dict[msg.id] = {"text":"貼圖id:"+str(stk_id),"from":msg._from,"createdTime":msg.createdTime} 1129 | else: 1130 | pass 1131 | except Exception as e: 1132 | print(e) 1133 | 1134 | #==============================================================================# 1135 | if op.type == 65: 1136 | print ("[ 65 ] REREAD") 1137 | try: 1138 | at = op.param1 1139 | msg_id = op.param2 1140 | if settings["reread"] == True: 1141 | if msg_id in msg_dict: 1142 | if msg_dict[msg_id]["from"] not in bl: 1143 | timeNow = datetime.now() 1144 | timE = datetime.strftime(timeNow,"(%y-%m-%d %H:%M:%S)") 1145 | try: 1146 | strt = int(3) 1147 | akh = int(3) 1148 | akh = akh + 8 1149 | aa = """{"S":"""+json.dumps(str(strt))+""","E":"""+json.dumps(str(akh))+""","M":"""+json.dumps(msg_dict[msg_id]["from"])+"},""" 1150 | aa = (aa[:int(len(aa)-1)]) 1151 | cl.sendMessage(at, "收回訊息者 @wanping ", contentMetadata={'MENTION':'{"MENTIONEES":['+aa+']}'}, contentType=0) 1152 | except Exception as e: 1153 | print(str(e)) 1154 | cl.sendMessage(at,"[メッセージ取り消し者]\n%s\n[メッセージ內容]\n%s"%(cl.getContact(msg_dict[msg_id]["from"]).displayName,msg_dict[msg_id]["text"])) 1155 | cl.sendMessage(at,"/n發送時間/n"+strftime("%y-%m-%d %H:%M:%S")+"/n收回時間/n"+timE) 1156 | 1157 | del msg_dict[msg_id] 1158 | else: 1159 | pass 1160 | except Exception as e: 1161 | print (e) 1162 | #==============================================================================# 1163 | if op.type == 55: 1164 | try: 1165 | if op.param1 in read['readPoint']: 1166 | if op.param2 in read['readMember'][op.param1]: 1167 | pass 1168 | else: 1169 | read['readMember'][op.param1] += op.param2 1170 | read['ROM'][op.param1][op.param2] = op.param2 1171 | else: 1172 | pass 1173 | except: 1174 | pass 1175 | try: 1176 | if op.param1 in wait2['readPoint']: 1177 | Name = cl.getContact(op.param2).displayName 1178 | if Name in wait2['readMember'][op.param1]: 1179 | pass 1180 | else: 1181 | wait2['readMember'][op.param1] += "\n[※]" + Name 1182 | wait2['ROM'][op.param1][op.param2] = "[※]" + Name 1183 | print (time.time() + name) 1184 | else: 1185 | pass 1186 | except: 1187 | pass 1188 | except Exception as error: 1189 | logError(error) 1190 | #==============================================================================# 1191 | while True: 1192 | try: 1193 | ops = oepoll.singleTrace(count=50) 1194 | if ops is not None: 1195 | for op in ops: 1196 | lineBot(op) 1197 | oepoll.setRevision(op.revision) 1198 | except Exception as e: 1199 | logError(e) 1200 | 1201 | --------------------------------------------------------------------------------