19 skills found
curl / CurlA command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, MQTTS, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features
NaiboWang / CommandlineConfigA library for users to write (experiment in research) configurations in Python Dict or JSON format, read and write parameter value via dot . in code, while can read parameters from the command line to modify values. 一个供用户以Python Dict或JSON格式编写(科研中实验)配置的库,在代码中用点.读写属性,同时可以从命令行中读取参数配置并修改参数值。
morgant / Tools OsxA small collection of command line tools for Mac OS X, incl.: clipcat, dict, eject, launch, ql, swuser, trash & with.
molyswu / Hand Detectionusing Neural Networks (SSD) on Tensorflow. This repo documents steps and scripts used to train a hand detector using Tensorflow (Object Detection API). As with any DNN based task, the most expensive (and riskiest) part of the process has to do with finding or creating the right (annotated) dataset. I was interested mainly in detecting hands on a table (egocentric view point). I experimented first with the [Oxford Hands Dataset](http://www.robots.ox.ac.uk/~vgg/data/hands/) (the results were not good). I then tried the [Egohands Dataset](http://vision.soic.indiana.edu/projects/egohands/) which was a much better fit to my requirements. The goal of this repo/post is to demonstrate how neural networks can be applied to the (hard) problem of tracking hands (egocentric and other views). Better still, provide code that can be adapted to other uses cases. If you use this tutorial or models in your research or project, please cite [this](#citing-this-tutorial). Here is the detector in action. <img src="images/hand1.gif" width="33.3%"><img src="images/hand2.gif" width="33.3%"><img src="images/hand3.gif" width="33.3%"> Realtime detection on video stream from a webcam . <img src="images/chess1.gif" width="33.3%"><img src="images/chess2.gif" width="33.3%"><img src="images/chess3.gif" width="33.3%"> Detection on a Youtube video. Both examples above were run on a macbook pro **CPU** (i7, 2.5GHz, 16GB). Some fps numbers are: | FPS | Image Size | Device| Comments| | ------------- | ------------- | ------------- | ------------- | | 21 | 320 * 240 | Macbook pro (i7, 2.5GHz, 16GB) | Run without visualizing results| | 16 | 320 * 240 | Macbook pro (i7, 2.5GHz, 16GB) | Run while visualizing results (image above) | | 11 | 640 * 480 | Macbook pro (i7, 2.5GHz, 16GB) | Run while visualizing results (image above) | > Note: The code in this repo is written and tested with Tensorflow `1.4.0-rc0`. Using a different version may result in [some errors](https://github.com/tensorflow/models/issues/1581). You may need to [generate your own frozen model](https://pythonprogramming.net/testing-custom-object-detector-tensorflow-object-detection-api-tutorial/?completed=/training-custom-objects-tensorflow-object-detection-api-tutorial/) graph using the [model checkpoints](model-checkpoint) in the repo to fit your TF version. **Content of this document** - Motivation - Why Track/Detect hands with Neural Networks - Data preparation and network training in Tensorflow (Dataset, Import, Training) - Training the hand detection Model - Using the Detector to Detect/Track hands - Thoughts on Optimizations. > P.S if you are using or have used the models provided here, feel free to reach out on twitter ([@vykthur](https://twitter.com/vykthur)) and share your work! ## Motivation - Why Track/Detect hands with Neural Networks? There are several existing approaches to tracking hands in the computer vision domain. Incidentally, many of these approaches are rule based (e.g extracting background based on texture and boundary features, distinguishing between hands and background using color histograms and HOG classifiers,) making them not very robust. For example, these algorithms might get confused if the background is unusual or in situations where sharp changes in lighting conditions cause sharp changes in skin color or the tracked object becomes occluded.(see [here for a review](https://www.cse.unr.edu/~bebis/handposerev.pdf) paper on hand pose estimation from the HCI perspective) With sufficiently large datasets, neural networks provide opportunity to train models that perform well and address challenges of existing object tracking/detection algorithms - varied/poor lighting, noisy environments, diverse viewpoints and even occlusion. The main drawbacks to usage for real-time tracking/detection is that they can be complex, are relatively slow compared to tracking-only algorithms and it can be quite expensive to assemble a good dataset. But things are changing with advances in fast neural networks. Furthermore, this entire area of work has been made more approachable by deep learning frameworks (such as the tensorflow object detection api) that simplify the process of training a model for custom object detection. More importantly, the advent of fast neural network models like ssd, faster r-cnn, rfcn (see [here](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md#coco-trained-models-coco-models) ) etc make neural networks an attractive candidate for real-time detection (and tracking) applications. Hopefully, this repo demonstrates this. > If you are not interested in the process of training the detector, you can skip straight to applying the [pretrained model I provide in detecting hands](#detecting-hands). Training a model is a multi-stage process (assembling dataset, cleaning, splitting into training/test partitions and generating an inference graph). While I lightly touch on the details of these parts, there are a few other tutorials cover training a custom object detector using the tensorflow object detection api in more detail[ see [here](https://pythonprogramming.net/training-custom-objects-tensorflow-object-detection-api-tutorial/) and [here](https://towardsdatascience.com/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9) ]. I recommend you walk through those if interested in training a custom object detector from scratch. ## Data preparation and network training in Tensorflow (Dataset, Import, Training) **The Egohands Dataset** The hand detector model is built using data from the [Egohands Dataset](http://vision.soic.indiana.edu/projects/egohands/) dataset. This dataset works well for several reasons. It contains high quality, pixel level annotations (>15000 ground truth labels) where hands are located across 4800 images. All images are captured from an egocentric view (Google glass) across 48 different environments (indoor, outdoor) and activities (playing cards, chess, jenga, solving puzzles etc). <img src="images/egohandstrain.jpg" width="100%"> If you will be using the Egohands dataset, you can cite them as follows: > Bambach, Sven, et al. "Lending a hand: Detecting hands and recognizing activities in complex egocentric interactions." Proceedings of the IEEE International Conference on Computer Vision. 2015. The Egohands dataset (zip file with labelled data) contains 48 folders of locations where video data was collected (100 images per folder). ``` -- LOCATION_X -- frame_1.jpg -- frame_2.jpg ... -- frame_100.jpg -- polygons.mat // contains annotations for all 100 images in current folder -- LOCATION_Y -- frame_1.jpg -- frame_2.jpg ... -- frame_100.jpg -- polygons.mat // contains annotations for all 100 images in current folder ``` **Converting data to Tensorflow Format** Some initial work needs to be done to the Egohands dataset to transform it into the format (`tfrecord`) which Tensorflow needs to train a model. This repo contains `egohands_dataset_clean.py` a script that will help you generate these csv files. - Downloads the egohands datasets - Renames all files to include their directory names to ensure each filename is unique - Splits the dataset into train (80%), test (10%) and eval (10%) folders. - Reads in `polygons.mat` for each folder, generates bounding boxes and visualizes them to ensure correctness (see image above). - Once the script is done running, you should have an images folder containing three folders - train, test and eval. Each of these folders should also contain a csv label document each - `train_labels.csv`, `test_labels.csv` that can be used to generate `tfrecords` Note: While the egohands dataset provides four separate labels for hands (own left, own right, other left, and other right), for my purpose, I am only interested in the general `hand` class and label all training data as `hand`. You can modify the data prep script to generate `tfrecords` that support 4 labels. Next: convert your dataset + csv files to tfrecords. A helpful guide on this can be found [here](https://pythonprogramming.net/creating-tfrecord-files-tensorflow-object-detection-api-tutorial/).For each folder, you should be able to generate `train.record`, `test.record` required in the training process. ## Training the hand detection Model Now that the dataset has been assembled (and your tfrecords), the next task is to train a model based on this. With neural networks, it is possible to use a process called [transfer learning](https://www.tensorflow.org/tutorials/image_retraining) to shorten the amount of time needed to train the entire model. This means we can take an existing model (that has been trained well on a related domain (here image classification) and retrain its final layer(s) to detect hands for us. Sweet!. Given that neural networks sometimes have thousands or millions of parameters that can take weeks or months to train, transfer learning helps shorten training time to possibly hours. Tensorflow does offer a few models (in the tensorflow [model zoo](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md#coco-trained-models-coco-models)) and I chose to use the `ssd_mobilenet_v1_coco` model as my start point given it is currently (one of) the fastest models (read the SSD research [paper here](https://arxiv.org/pdf/1512.02325.pdf)). The training process can be done locally on your CPU machine which may take a while or better on a (cloud) GPU machine (which is what I did). For reference, training on my macbook pro (tensorflow compiled from source to take advantage of the mac's cpu architecture) the maximum speed I got was 5 seconds per step as opposed to the ~0.5 seconds per step I got with a GPU. For reference it would take about 12 days to run 200k steps on my mac (i7, 2.5GHz, 16GB) compared to ~5hrs on a GPU. > **Training on your own images**: Please use the [guide provided by Harrison from pythonprogramming](https://pythonprogramming.net/training-custom-objects-tensorflow-object-detection-api-tutorial/) on how to generate tfrecords given your label csv files and your images. The guide also covers how to start the training process if training locally. [see [here] (https://pythonprogramming.net/training-custom-objects-tensorflow-object-detection-api-tutorial/)]. If training in the cloud using a service like GCP, see the [guide here](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_on_cloud.md). As the training process progresses, the expectation is that total loss (errors) gets reduced to its possible minimum (about a value of 1 or thereabout). By observing the tensorboard graphs for total loss(see image below), it should be possible to get an idea of when the training process is complete (total loss does not decrease with further iterations/steps). I ran my training job for 200k steps (took about 5 hours) and stopped at a total Loss (errors) value of 2.575.(In retrospect, I could have stopped the training at about 50k steps and gotten a similar total loss value). With tensorflow, you can also run an evaluation concurrently that assesses your model to see how well it performs on the test data. A commonly used metric for performance is mean average precision (mAP) which is single number used to summarize the area under the precision-recall curve. mAP is a measure of how well the model generates a bounding box that has at least a 50% overlap with the ground truth bounding box in our test dataset. For the hand detector trained here, the mAP value was **0.9686@0.5IOU**. mAP values range from 0-1, the higher the better. <img src="images/accuracy.jpg" width="100%"> Once training is completed, the trained inference graph (`frozen_inference_graph.pb`) is then exported (see the earlier referenced guides for how to do this) and saved in the `hand_inference_graph` folder. Now its time to do some interesting detection. ## Using the Detector to Detect/Track hands If you have not done this yet, please following the guide on installing [Tensorflow and the Tensorflow object detection api](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md). This will walk you through setting up the tensorflow framework, cloning the tensorflow github repo and a guide on - Load the `frozen_inference_graph.pb` trained on the hands dataset as well as the corresponding label map. In this repo, this is done in the `utils/detector_utils.py` script by the `load_inference_graph` method. ```python detection_graph = tf.Graph() with detection_graph.as_default(): od_graph_def = tf.GraphDef() with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid: serialized_graph = fid.read() od_graph_def.ParseFromString(serialized_graph) tf.import_graph_def(od_graph_def, name='') sess = tf.Session(graph=detection_graph) print("> ====== Hand Inference graph loaded.") ``` - Detect hands. In this repo, this is done in the `utils/detector_utils.py` script by the `detect_objects` method. ```python (boxes, scores, classes, num) = sess.run( [detection_boxes, detection_scores, detection_classes, num_detections], feed_dict={image_tensor: image_np_expanded}) ``` - Visualize detected bounding detection_boxes. In this repo, this is done in the `utils/detector_utils.py` script by the `draw_box_on_image` method. This repo contains two scripts that tie all these steps together. - detect_multi_threaded.py : A threaded implementation for reading camera video input detection and detecting. Takes a set of command line flags to set parameters such as `--display` (visualize detections), image parameters `--width` and `--height`, videe `--source` (0 for camera) etc. - detect_single_threaded.py : Same as above, but single threaded. This script works for video files by setting the video source parameter videe `--source` (path to a video file). ```cmd # load and run detection on video at path "videos/chess.mov" python detect_single_threaded.py --source videos/chess.mov ``` > Update: If you do have errors loading the frozen inference graph in this repo, feel free to generate a new graph that fits your TF version from the model-checkpoint in this repo. Use the [export_inference_graph.py](https://github.com/tensorflow/models/blob/master/research/object_detection/export_inference_graph.py) script provided in the tensorflow object detection api repo. More guidance on this [here](https://pythonprogramming.net/testing-custom-object-detector-tensorflow-object-detection-api-tutorial/?completed=/training-custom-objects-tensorflow-object-detection-api-tutorial/). ## Thoughts on Optimization. A few things that led to noticeable performance increases. - Threading: Turns out that reading images from a webcam is a heavy I/O event and if run on the main application thread can slow down the program. I implemented some good ideas from [Adrian Rosebuck](https://www.pyimagesearch.com/2017/02/06/faster-video-file-fps-with-cv2-videocapture-and-opencv/) on parrallelizing image capture across multiple worker threads. This mostly led to an FPS increase of about 5 points. - For those new to Opencv, images from the `cv2.read()` method return images in [BGR format](https://www.learnopencv.com/why-does-opencv-use-bgr-color-format/). Ensure you convert to RGB before detection (accuracy will be much reduced if you dont). ```python cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB) ``` - Keeping your input image small will increase fps without any significant accuracy drop.(I used about 320 x 240 compared to the 1280 x 720 which my webcam provides). - Model Quantization. Moving from the current 32 bit to 8 bit can achieve up to 4x reduction in memory required to load and store models. One way to further speed up this model is to explore the use of [8-bit fixed point quantization](https://heartbeat.fritz.ai/8-bit-quantization-and-tensorflow-lite-speeding-up-mobile-inference-with-low-precision-a882dfcafbbd). Performance can also be increased by a clever combination of tracking algorithms with the already decent detection and this is something I am still experimenting with. Have ideas for optimizing better, please share! <img src="images/general.jpg" width="100%"> Note: The detector does reflect some limitations associated with the training set. This includes non-egocentric viewpoints, very noisy backgrounds (e.g in a sea of hands) and sometimes skin tone. There is opportunity to improve these with additional data. ## Integrating Multiple DNNs. One way to make things more interesting is to integrate our new knowledge of where "hands" are with other detectors trained to recognize other objects. Unfortunately, while our hand detector can in fact detect hands, it cannot detect other objects (a factor or how it is trained). To create a detector that classifies multiple different objects would mean a long involved process of assembling datasets for each class and a lengthy training process. > Given the above, a potential strategy is to explore structures that allow us **efficiently** interleave output form multiple pretrained models for various object classes and have them detect multiple objects on a single image. An example of this is with my primary use case where I am interested in understanding the position of objects on a table with respect to hands on same table. I am currently doing some work on a threaded application that loads multiple detectors and outputs bounding boxes on a single image. More on this soon.
rbaron / Dict.cc.py📘 Unofficial command line client for dict.cc
NishNishendanidu / Mtroid BotGENARATED BY NISHEN Mtroid whatsApp bot 🪀 Command:`setup `✨️ Description:` edit bot settings `⚠️️ Warn `🪀 Command:` install <br> `✨️ Description:` Install external plugins. <br> `⚠️️ Warn:` Get plugins only from https://t.me/AlphaXplugin. `🪀 Command:` plugin<br> `✨️ Description:` Shows the plugins you have installed. `🪀 Command:` remove<br> `✨️ Description:` Removes the plugin. `🪀 Command:` admin<br> `✨️ Description:` Admin menu. `🪀 Command:` ban <br> `✨️ Description:` Ban someone in the group. Reply to message or tag a person to use command. `🪀 Command:` gname <br> `✨️ Description:` Change group name. `🪀 Command:` gdesc<br> `✨️ Description:` Change group discription. `🪀 Command:` dis <br> `✨️ Description:` Disappearing message on/off. <br> `💡 Example:` .dis on/off `🪀 Command:` reset<br> `✨️ Description:` Reset group invitation link. `🪀 Command:` gpp<br> `✨️ Description:` Set group profile picture `🪀 Command:` add<br> `✨️ Description:` Adds someone to the group. `🪀 Command:` promote <br> `✨️ Description:` Makes any person an admin. `🪀 Command:` demote <br> `✨️ Description:` Takes the authority of any admin. `🪀 Command:` mute <br> `✨️ Description:` Mute the group chat. Only the admins can send a message. ⌨️ Example: .mute & .mute 5m etc `🪀 Command:` unmute <br> `✨️ Description:` Unmute the group chat. Anyone can send a message. `🪀 Command:` invite <br> `✨️ Description:` Provides the group's invitation link. `🪀 Command:` afk <br> `✨️ Description:` It makes you AFK - Away From Keyboard. `🪀 Command:` art pack<br> `✨️ Description:` Beautifull artpack with more than 100 messages. `🪀 Command:` aspm <br> `✨️ Description:` This command for any emergency situation about any kind of WhatsApp SPAM in Group `🪀 Command:` alag <br> `✨️ Description:` This command for any emergency situation about any kind of WhatsApp SPAM in Chat `🪀 Command:` linkblock <br> `✨️ Description:` Activates the block link tool. <br> `💡 Example:` .linkblock on / off `🪀 Command:` CrAsH<br> `✨️ Description:` send BUG VIRUS to group. `🪀 Command:` CrAsH high<br> `✨️ Description:` send BUG VIRUS to group untill you stop. `🪀 Command:` -carbon `🪀 Command:` clear<br> `✨️ Description:` Clears all the messages from the chat. `🪀 Command:` qr <br> `✨️ Description:` To create an qr code from the word you give. `🪀 Command:` bcode <br> `✨️ Description:` To create an barcode from the word you give. `🪀 Command:` compliment<br> `✨️ Description:` It sends complimentry sentenses. `🪀 Command:` toaudio<br> `✨️ Description:` Converts video to sound. `🪀 Command:` toimage<br> `✨️ Description:` Converts the sticker to a photo. `🪀 Command:` tovideo<br> `✨️ Description:` Converts animated stickers to video. `🪀 Command:` deepai<br> `✨️ Description:` Runs the most powerful artificial intelligence tools using artificial neural networks. `🪀 Command:` details<br> `✨️ Description:` Displays metadata data of group or person. `🪀 Command:` dict <br> `✨️ Description:` Use it as a dictionary. Eg: .dict enUS;lead For supporting languages send •.lngcode• `🪀 Command:` dst<br> `✨️ Description:` Download status you repled. `🪀 Command:` emedia<br> `✨️ Description:` It is a plugin with more than 25 media tools. `🪀 Command:` emoji <br> `✨️ Description:` You can get Emoji as image. `🪀 Command:` print <br> `✨️ Description:` Prints the inside of the file on the server. `🪀 Command:` bashmedia <br> `✨️ Description:` Sends audio, video and photos inside the server. <br> `💡 Example:` video.mp4 && media/gif/pic.mp4 `🪀 Command:` addserver<br> `✨️ Description:` Uploads image, audio or video to the server. `🪀 Command:` term <br> `✨️ Description:` Allows to run the command on the server's shell. `🪀 Command:` mediainfo<br> `✨️ Description:` Shows the technical information of the replied video. `🪀 Command:` pmsend <br> `✨️ Description:` Sends a private message to the replied person. `🪀 Command:` pmttssend <br> `✨️ Description:` Sends a private voice message to the respondent. `🪀 Command:` ffmpeg <br> `✨️ Description:` Applies the desired ffmpeg filter to the video. ⌨️ Example: .ffmpeg fade=in:0:30 `🪀 Command:` filter <br> `✨️ Description:` It adds a filter. If someone writes your filter, it send the answer. If you just write .filter, it show's your filter list. `🪀 Command:` stop <br> `✨️ Description:` Stops the filter you added previously. `🪀 Command:` bgmlist<br> `✨️ Description:` Bgm List. `🪀 Command:` github <br> `✨️ Description:` It Send Github User Data. <br> `💡 Example:` .github WhatsApp `🪀 Command:` welcome<br> `✨️ Description:` It sets the welcome message. If you leave it blank it shows the welcome message. `🪀 Command:` goodbye<br> `✨️ Description:` Sets the goodbye message. If you leave blank, it show's the goodbye message. `🪀 Command:` help<br> `✨️ Description:` Gives information about using the bot from the Help menu. `🪀 Command:` varset <br> `✨️ Description:` Changes the text of modules like alive, afk etc.. `🪀 Command:` restart<br> `✨️ Description:` Restart bot. `🪀 Command:` poweroff<br> `✨️ Description:` Shutdown bot. `🪀 Command:` dyno<br> `✨️ Description:` Check heroku dyno usage `🪀 Command:` setvar <br> `✨️ Description:` Set heroku config var `🪀 Command:` delvar <br> `✨️ Description:` Delete heroku config var `🪀 Command:` getvar <br> `✨️ Description:` Get heroku config var `🪀 Command:` hpmod <br> `✨️ Description:` To get mod apps info. `🪀 Command:` insult<br> `✨️ Description:` It gives random insults. `🪀 Command:` locate<br> `✨️ Description:` It send your location. <br> `⚠️️ Warn:` Please open your location before using command! `🪀 Command:` logmsg<br> `✨️ Description:` Saves the message you reply to your private number. <br> `⚠️️ Warn:` Does not support animated stickers! `🪀 Command:` logomaker<br> `✨️ Description:` Shows logomaker tools with unlimited access. `🪀 Command:` meme <br> `✨️ Description:` Photo memes you replied to. `🪀 Command:` movie <br> `✨️ Description:` Shows movie info. `🪀 Command:` neko<br> `✨️ Description:` Replied messages will be added to nekobin.com. `🪀 Command:` song <br> `✨️ Description:` Uploads the song you wrote. `🪀 Command:` video <br> `✨️ Description:` Downloads video from YouTube. `🪀 Command:` fb <br> `✨️ Description:` Download video from facebook. `🪀 Command:` tiktok <br> `✨️ Description:` Download tiktok video. `🪀 Command:` notes<br> `✨️ Description:` Shows all your existing notes. `🪀 Command:` save <br> `✨️ Description:` Reply a message and type .save or just use .save <Your note> without replying `🪀 Command:` deleteNotes<br> `✨️ Description:` Deletes *all* your saved notes. `🪀 Command:` ocr <br> `✨️ Description:` Reads the text on the photo you have replied. `🪀 Command:` pinimg <br> `✨️ Description:` Downloas images from Pinterest. `🪀 Command:` playst <br> `✨️ Description:` Get app details from play store. `🪀 Command:` profile<br> `✨️ Description:` Profile menu. `🪀 Command:` getpp<br> `✨️ Description:` Get pofile picture. `🪀 Command:` setbio <br> `✨️ Description:` Set your about. `🪀 Command:` getbio<br> `✨️ Description:` Get user about. `🪀 Command:` archive<br> `✨️ Description:` Archive chat. `🪀 Command:` unarchive<br> `✨️ Description:` Unarchive chat. `🪀 Command:` pin<br> `✨️ Description:` Archive chat. `🪀 Command:` unpin<br> `✨️ Description:` Unarchive chat. `🪀 Command:` pp<br> `✨️ Description:` Makes the profile photo what photo you reply. `🪀 Command:` kickme<br> `✨️ Description:` It kicks you from the group you are using it in. `🪀 Command:` block <br> `✨️ Description:` Block user. `🪀 Command:` unblock <br> `✨️ Description:` Unblock user. `🪀 Command:` jid <br> `✨️ Description:` Giving user's JID. `🪀 Command:` rdmore <br> `✨️ Description:` Add readmore to your message >> Use # to get readmore. `🪀 Command:` removebg <br> `✨️ Description:` Removes the background of the photos. `🪀 Command:` report <br> `✨️ Description:` Sends reports to group admins. `🪀 Command:` roll<br> `✨️ Description:` Roll dice randomly. `🪀 Command:` scam <br> `✨️ Description:` Creates 5 minutes of fake actions. `🪀 Command:` scan <br> `✨️ Description:` Checks whether the entered number is registered on WhatApp. `🪀 Command:` trt<br> `✨️ Description:` It translates with Google Translate. You must reply any message. <br> `💡 Example:` .trt en si (From English to Sinhala) `🪀 Command:` antilink <br> `✨️ Description:` Activates the Antilink tool. <br> `💡 Example:` .antilink on / off `🪀 Command:` autobio <br> `✨️ Description:` Add live clock to your bio! <br> `💡 Example:` .autobio on / off `🪀 Command:` detectlang<br> `✨️ Description:` Guess the language of the replied message. `🪀 Command:` currency `🪀 Command:` tts <br> `✨️ Description:` It converts text to sound. `🪀 Command:` music <br> `✨️ Description:` Uploads the song you wrote. `🪀 Command:` smp3 <br> `✨️ Description:` Get song as a mp3 documet file `🪀 Command:` mp4 <br> `✨️ Description:` Downloads video from YouTube. `🪀 Command:` yt <br> `✨️ Description:` It searchs on YouTube. `🪀 Command:` wiki <br> `✨️ Description:` Searches query on Wikipedia. `🪀 Command:` img <br> `✨️ Description:` Searches for related pics on Google. `🪀 Command:` lyric <br> `✨️ Description:` Finds the lyrics of the song. `🪀 Command:` covid <br> `✨️ Description:` Shows the daily and overall covid table of more than 15 countries. `🪀 Command:` ss <br> `✨️ Description:` Takes a screenshot from the page in the given link. `🪀 Command:` simi <br> `✨️ Description:` Are you bored? ... Fool around with SimSimi. ... World first popular Chatbot for daily conversation. `🪀 Command:` spdf <br> `✨️ Description:` Site to pdf file. `🪀 Command:` insta <br> `✨️ Description:` Downloads videos or photos from Instagram. `🪀 Command:` animesay <br> `✨️ Description:` It writes the text inside the banner the anime girl is holding `🪀 Command:` changesay <br> `✨️ Description:` Turns the text into the change my mind poster. `🪀 Command:` trumpsay <br> `✨️ Description:` Converts the text to Trump's tweet. `🪀 Command:` audio spam<br> `✨️ Description:` Sends the replied audio as spam. `🪀 Command:` foto spam<br> `✨️ Description:` Sends the replied photo as spam. `🪀 Command:` sticker spam<br> `✨️ Description:` Convert the replied photo or video to sticker and send it as spam. `🪀 Command:` vid spam `🪀 Command:` killspam<br> `✨️ Description:` Stops spam command. `🪀 Command:` spam <br> `✨️ Description:` It spam until you stop it. ⌨️ Example: .spam test `🪀 Command:` spotify <br> `✨️ Description:` Get music details from spotify. `🪀 Command:` st<br> `✨️ Description:` It converts your replied photo or video to sticker. `🪀 Command:` sweather<br> `✨️ Description:` Gives you the weekly interpretations of space weather observations provided by the Space Weather Research Center (SWRC) for a p. `🪀 Command:` alive <br> `✨️ Description:` Does bot work? `🪀 Command:` sysd<br> `✨️ Description:` Shows the system properties. `🪀 Command:` tagadmin `🪀 Command:` tg <br> `✨️ Description:` Tags everyone in the group. `🪀 Command:` pmall<br> `✨️ Description:` Sends the replied message to all members in the group. `🪀 Command:` tblend <br> `✨️ Description:` Applies the selected TBlend effect to videos. `🪀 Command:` link<br> `✨️ Description:` The image you reply to uploads to telegra.ph and provides its link. `🪀 Command:` unvoice<br> `✨️ Description:` Converts audio to sound recording. `🪀 Command:` up<br> `✨️ Description:` Checks the update your bot. `🪀 Command:` up now<br> `✨️ Description:` It makes updates. `🪀 Command:` voicy<br> `✨️ Description:` It converts audio to text. `🪀 Command:` wp<br> `✨️ Description:` It sends high resolution wallpapers. `🪀 Command:` wame <br> `✨️ Description:` Get a link to the user chat. `🪀 Command:` weather <br> `✨️ Description:` Shows the weather. `🪀 Command:` speedtest <br> `✨️ Description:` Measures Download and Upload speed. <br> `💡 Example:` speedtest user // speedtest server `🪀 Command:` ping<br> `✨️ Description:` Measures your ping. `🪀 Command:` short <br> `✨️ Description:` Shorten the long link. `🪀 Command:` calc <br> `✨️ Description:` Performs simple math operations. `🪀 Command:` xapi<br> `✨️ Description:` Xteam API key info. `🪀 Command:` joke<br> `✨️ Description:` Send random jokes. `🪀 Command:` quote<br> `✨️ Description:` Send random quotes.
qhwa / Command Line Youdao Dictionary在命令行中查单词,使用网易有道词典
RubyLane / Rl JsonExtends Tcl with a json value type and a command to manipulate json values directly. Similar in spirit to how the dict command manipulates dictionary values, and comparable in speed
joidegn / Leo Clia simple command line tool for http://dict.leo.org
LPX-E5BD8 / GdictA command line dictionary written in golang powered by multi engines.
lijiaqi0612 / UIE ACL 310有一个通用实体关系事件抽取的任务,需要使用到UIE模框架,而且需要将起部署到昇腾310服务器上,因为UIE模型底层使用的是ernie3.0,但是目前paddle官方还不支持ernie3.0模型在昇腾310上部署,所以才有了以下的操作,主要过程是,先试用paddle训练处模型,然后使用 paddle2onnx.command.c_paddle_to_onnx方法将paddle的模型转为onnx模型 ,因现在的onnx模型是动态的shape和散乱的算子形态,需要使用paddle自带的工具paddle2onnx.optimize将onnx模型先进行重塑,固定好shape的维度,将散乱的算子进行整合,命令如下: $ python -m paddle2onnx.optimize --input_model /home/user/lijiaqi/PaddleNLP/model_zoo/uie/export_new/model.onnx --output_model /home/user/lijiaqi/model_new_uie.onnx --input_shape_dict "{'att_mask':[1,512],'pos_ids':[1,512],'token_type_ids':[1,512],'input_ids':[1,512]}" 然后将onnx模型在使用ATC工具转为acl所需要的om模型,这一步后面会讲。 另外在使用acl部署的时候,paddle框架是不能使用的,acl使用到的模型和训练过程均需要自己实现,包括from_pretrain阶段的分词,建立词表,数据处理部分,这部分我已经实现完,纯python版本的实现
YanjieHe / Command Line Bing DictionaryA command-line Bing dictionary running on Linux
hyva-themes / Magento2 I18n Csv DiffMagento commands to find translations that are present in one CSV file but not in another, and to translate CSV dicts with DeepL
derhuerst / Dict Cc CliOffline dict.cc lookup in the command line.
haseebalam / Python Twitter Apisoftware # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''A library that provides a Python interface to the Twitter API''' import base64 import calendar import datetime import httplib import os import rfc822 import sys import tempfile import textwrap import time import calendar import urllib import urllib2 import urlparse import gzip import StringIO try: # Python >= 2.6 import json as simplejson except ImportError: try: # Python < 2.6 import simplejson except ImportError: try: # Google App Engine from django.utils import simplejson except ImportError: raise ImportError, "Unable to load a json library" # parse_qsl moved to urlparse module in v2.6 try: from urlparse import parse_qsl, parse_qs except ImportError: from cgi import parse_qsl, parse_qs try: from hashlib import md5 except ImportError: from md5 import md5 import oauth2 as oauth CHARACTER_LIMIT = 140 # A singleton representing a lazily instantiated FileCache. DEFAULT_CACHE = object() REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' class TwitterError(Exception): '''Base class for Twitter errors''' @property def message(self): '''Returns the first argument used to construct this error.''' return self.args[0] class Status(object): '''A class representing the Status structure used by the twitter API. The Status structure exposes the following properties: status.created_at status.created_at_in_seconds # read only status.favorited status.in_reply_to_screen_name status.in_reply_to_user_id status.in_reply_to_status_id status.truncated status.source status.id status.text status.location status.relative_created_at # read only status.user status.urls status.user_mentions status.hashtags status.geo status.place status.coordinates status.contributors ''' def __init__(self, created_at=None, favorited=None, id=None, text=None, location=None, user=None, in_reply_to_screen_name=None, in_reply_to_user_id=None, in_reply_to_status_id=None, truncated=None, source=None, now=None, urls=None, user_mentions=None, hashtags=None, geo=None, place=None, coordinates=None, contributors=None, retweeted=None, retweeted_status=None, retweet_count=None): '''An object to hold a Twitter status message. This class is normally instantiated by the twitter.Api class and returned in a sequence. Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" Args: created_at: The time this status message was posted. [Optional] favorited: Whether this is a favorite of the authenticated user. [Optional] id: The unique id of this status message. [Optional] text: The text of this status message. [Optional] location: the geolocation string associated with this message. [Optional] relative_created_at: A human readable string representing the posting time. [Optional] user: A twitter.User instance representing the person posting the message. [Optional] now: The current time, if the client choses to set it. Defaults to the wall clock time. [Optional] urls: user_mentions: hashtags: geo: place: coordinates: contributors: retweeted: retweeted_status: retweet_count: ''' self.created_at = created_at self.favorited = favorited self.id = id self.text = text self.location = location self.user = user self.now = now self.in_reply_to_screen_name = in_reply_to_screen_name self.in_reply_to_user_id = in_reply_to_user_id self.in_reply_to_status_id = in_reply_to_status_id self.truncated = truncated self.retweeted = retweeted self.source = source self.urls = urls self.user_mentions = user_mentions self.hashtags = hashtags self.geo = geo self.place = place self.coordinates = coordinates self.contributors = contributors self.retweeted_status = retweeted_status self.retweet_count = retweet_count def GetCreatedAt(self): '''Get the time this status message was posted. Returns: The time this status message was posted ''' return self._created_at def SetCreatedAt(self, created_at): '''Set the time this status message was posted. Args: created_at: The time this status message was created ''' self._created_at = created_at created_at = property(GetCreatedAt, SetCreatedAt, doc='The time this status message was posted.') def GetCreatedAtInSeconds(self): '''Get the time this status message was posted, in seconds since the epoch. Returns: The time this status message was posted, in seconds since the epoch. ''' return calendar.timegm(rfc822.parsedate(self.created_at)) created_at_in_seconds = property(GetCreatedAtInSeconds, doc="The time this status message was " "posted, in seconds since the epoch") def GetFavorited(self): '''Get the favorited setting of this status message. Returns: True if this status message is favorited; False otherwise ''' return self._favorited def SetFavorited(self, favorited): '''Set the favorited state of this status message. Args: favorited: boolean True/False favorited state of this status message ''' self._favorited = favorited favorited = property(GetFavorited, SetFavorited, doc='The favorited state of this status message.') def GetId(self): '''Get the unique id of this status message. Returns: The unique id of this status message ''' return self._id def SetId(self, id): '''Set the unique id of this status message. Args: id: The unique id of this status message ''' self._id = id id = property(GetId, SetId, doc='The unique id of this status message.') def GetInReplyToScreenName(self): return self._in_reply_to_screen_name def SetInReplyToScreenName(self, in_reply_to_screen_name): self._in_reply_to_screen_name = in_reply_to_screen_name in_reply_to_screen_name = property(GetInReplyToScreenName, SetInReplyToScreenName, doc='') def GetInReplyToUserId(self): return self._in_reply_to_user_id def SetInReplyToUserId(self, in_reply_to_user_id): self._in_reply_to_user_id = in_reply_to_user_id in_reply_to_user_id = property(GetInReplyToUserId, SetInReplyToUserId, doc='') def GetInReplyToStatusId(self): return self._in_reply_to_status_id def SetInReplyToStatusId(self, in_reply_to_status_id): self._in_reply_to_status_id = in_reply_to_status_id in_reply_to_status_id = property(GetInReplyToStatusId, SetInReplyToStatusId, doc='') def GetTruncated(self): return self._truncated def SetTruncated(self, truncated): self._truncated = truncated truncated = property(GetTruncated, SetTruncated, doc='') def GetRetweeted(self): return self._retweeted def SetRetweeted(self, retweeted): self._retweeted = retweeted retweeted = property(GetRetweeted, SetRetweeted, doc='') def GetSource(self): return self._source def SetSource(self, source): self._source = source source = property(GetSource, SetSource, doc='') def GetText(self): '''Get the text of this status message. Returns: The text of this status message. ''' return self._text def SetText(self, text): '''Set the text of this status message. Args: text: The text of this status message ''' self._text = text text = property(GetText, SetText, doc='The text of this status message') def GetLocation(self): '''Get the geolocation associated with this status message Returns: The geolocation string of this status message. ''' return self._location def SetLocation(self, location): '''Set the geolocation associated with this status message Args: location: The geolocation string of this status message ''' self._location = location location = property(GetLocation, SetLocation, doc='The geolocation string of this status message') def GetRelativeCreatedAt(self): '''Get a human redable string representing the posting time Returns: A human readable string representing the posting time ''' fudge = 1.25 delta = long(self.now) - long(self.created_at_in_seconds) if delta < (1 * fudge): return 'about a second ago' elif delta < (60 * (1/fudge)): return 'about %d seconds ago' % (delta) elif delta < (60 * fudge): return 'about a minute ago' elif delta < (60 * 60 * (1/fudge)): return 'about %d minutes ago' % (delta / 60) elif delta < (60 * 60 * fudge) or delta / (60 * 60) == 1: return 'about an hour ago' elif delta < (60 * 60 * 24 * (1/fudge)): return 'about %d hours ago' % (delta / (60 * 60)) elif delta < (60 * 60 * 24 * fudge) or delta / (60 * 60 * 24) == 1: return 'about a day ago' else: return 'about %d days ago' % (delta / (60 * 60 * 24)) relative_created_at = property(GetRelativeCreatedAt, doc='Get a human readable string representing ' 'the posting time') def GetUser(self): '''Get a twitter.User reprenting the entity posting this status message. Returns: A twitter.User reprenting the entity posting this status message ''' return self._user def SetUser(self, user): '''Set a twitter.User reprenting the entity posting this status message. Args: user: A twitter.User reprenting the entity posting this status message ''' self._user = user user = property(GetUser, SetUser, doc='A twitter.User reprenting the entity posting this ' 'status message') def GetNow(self): '''Get the wallclock time for this status message. Used to calculate relative_created_at. Defaults to the time the object was instantiated. Returns: Whatever the status instance believes the current time to be, in seconds since the epoch. ''' if self._now is None: self._now = time.time() return self._now def SetNow(self, now): '''Set the wallclock time for this status message. Used to calculate relative_created_at. Defaults to the time the object was instantiated. Args: now: The wallclock time for this instance. ''' self._now = now now = property(GetNow, SetNow, doc='The wallclock time for this status instance.') def GetGeo(self): return self._geo def SetGeo(self, geo): self._geo = geo geo = property(GetGeo, SetGeo, doc='') def GetPlace(self): return self._place def SetPlace(self, place): self._place = place place = property(GetPlace, SetPlace, doc='') def GetCoordinates(self): return self._coordinates def SetCoordinates(self, coordinates): self._coordinates = coordinates coordinates = property(GetCoordinates, SetCoordinates, doc='') def GetContributors(self): return self._contributors def SetContributors(self, contributors): self._contributors = contributors contributors = property(GetContributors, SetContributors, doc='') def GetRetweeted_status(self): return self._retweeted_status def SetRetweeted_status(self, retweeted_status): self._retweeted_status = retweeted_status retweeted_status = property(GetRetweeted_status, SetRetweeted_status, doc='') def GetRetweetCount(self): return self._retweet_count def SetRetweetCount(self, retweet_count): self._retweet_count = retweet_count retweet_count = property(GetRetweetCount, SetRetweetCount, doc='') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.created_at == other.created_at and \ self.id == other.id and \ self.text == other.text and \ self.location == other.location and \ self.user == other.user and \ self.in_reply_to_screen_name == other.in_reply_to_screen_name and \ self.in_reply_to_user_id == other.in_reply_to_user_id and \ self.in_reply_to_status_id == other.in_reply_to_status_id and \ self.truncated == other.truncated and \ self.retweeted == other.retweeted and \ self.favorited == other.favorited and \ self.source == other.source and \ self.geo == other.geo and \ self.place == other.place and \ self.coordinates == other.coordinates and \ self.contributors == other.contributors and \ self.retweeted_status == other.retweeted_status and \ self.retweet_count == other.retweet_count except AttributeError: return False def __str__(self): '''A string representation of this twitter.Status instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.Status instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.Status instance. Returns: A JSON string representation of this twitter.Status instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.Status instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.Status instance ''' data = {} if self.created_at: data['created_at'] = self.created_at if self.favorited: data['favorited'] = self.favorited if self.id: data['id'] = self.id if self.text: data['text'] = self.text if self.location: data['location'] = self.location if self.user: data['user'] = self.user.AsDict() if self.in_reply_to_screen_name: data['in_reply_to_screen_name'] = self.in_reply_to_screen_name if self.in_reply_to_user_id: data['in_reply_to_user_id'] = self.in_reply_to_user_id if self.in_reply_to_status_id: data['in_reply_to_status_id'] = self.in_reply_to_status_id if self.truncated is not None: data['truncated'] = self.truncated if self.retweeted is not None: data['retweeted'] = self.retweeted if self.favorited is not None: data['favorited'] = self.favorited if self.source: data['source'] = self.source if self.geo: data['geo'] = self.geo if self.place: data['place'] = self.place if self.coordinates: data['coordinates'] = self.coordinates if self.contributors: data['contributors'] = self.contributors if self.hashtags: data['hashtags'] = [h.text for h in self.hashtags] if self.retweeted_status: data['retweeted_status'] = self.retweeted_status.AsDict() if self.retweet_count: data['retweet_count'] = self.retweet_count return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Status instance ''' if 'user' in data: user = User.NewFromJsonDict(data['user']) else: user = None if 'retweeted_status' in data: retweeted_status = Status.NewFromJsonDict(data['retweeted_status']) else: retweeted_status = None urls = None user_mentions = None hashtags = None if 'entities' in data: if 'urls' in data['entities']: urls = [Url.NewFromJsonDict(u) for u in data['entities']['urls']] if 'user_mentions' in data['entities']: user_mentions = [User.NewFromJsonDict(u) for u in data['entities']['user_mentions']] if 'hashtags' in data['entities']: hashtags = [Hashtag.NewFromJsonDict(h) for h in data['entities']['hashtags']] return Status(created_at=data.get('created_at', None), favorited=data.get('favorited', None), id=data.get('id', None), text=data.get('text', None), location=data.get('location', None), in_reply_to_screen_name=data.get('in_reply_to_screen_name', None), in_reply_to_user_id=data.get('in_reply_to_user_id', None), in_reply_to_status_id=data.get('in_reply_to_status_id', None), truncated=data.get('truncated', None), retweeted=data.get('retweeted', None), source=data.get('source', None), user=user, urls=urls, user_mentions=user_mentions, hashtags=hashtags, geo=data.get('geo', None), place=data.get('place', None), coordinates=data.get('coordinates', None), contributors=data.get('contributors', None), retweeted_status=retweeted_status, retweet_count=data.get('retweet_count', None)) class User(object): '''A class representing the User structure used by the twitter API. The User structure exposes the following properties: user.id user.name user.screen_name user.location user.description user.profile_image_url user.profile_background_tile user.profile_background_image_url user.profile_sidebar_fill_color user.profile_background_color user.profile_link_color user.profile_text_color user.protected user.utc_offset user.time_zone user.url user.status user.statuses_count user.followers_count user.friends_count user.favourites_count user.geo_enabled user.verified user.lang user.notifications user.contributors_enabled user.created_at user.listed_count ''' def __init__(self, id=None, name=None, screen_name=None, location=None, description=None, profile_image_url=None, profile_background_tile=None, profile_background_image_url=None, profile_sidebar_fill_color=None, profile_background_color=None, profile_link_color=None, profile_text_color=None, protected=None, utc_offset=None, time_zone=None, followers_count=None, friends_count=None, statuses_count=None, favourites_count=None, url=None, status=None, geo_enabled=None, verified=None, lang=None, notifications=None, contributors_enabled=None, created_at=None, listed_count=None): self.id = id self.name = name self.screen_name = screen_name self.location = location self.description = description self.profile_image_url = profile_image_url self.profile_background_tile = profile_background_tile self.profile_background_image_url = profile_background_image_url self.profile_sidebar_fill_color = profile_sidebar_fill_color self.profile_background_color = profile_background_color self.profile_link_color = profile_link_color self.profile_text_color = profile_text_color self.protected = protected self.utc_offset = utc_offset self.time_zone = time_zone self.followers_count = followers_count self.friends_count = friends_count self.statuses_count = statuses_count self.favourites_count = favourites_count self.url = url self.status = status self.geo_enabled = geo_enabled self.verified = verified self.lang = lang self.notifications = notifications self.contributors_enabled = contributors_enabled self.created_at = created_at self.listed_count = listed_count def GetId(self): '''Get the unique id of this user. Returns: The unique id of this user ''' return self._id def SetId(self, id): '''Set the unique id of this user. Args: id: The unique id of this user. ''' self._id = id id = property(GetId, SetId, doc='The unique id of this user.') def GetName(self): '''Get the real name of this user. Returns: The real name of this user ''' return self._name def SetName(self, name): '''Set the real name of this user. Args: name: The real name of this user ''' self._name = name name = property(GetName, SetName, doc='The real name of this user.') def GetScreenName(self): '''Get the short twitter name of this user. Returns: The short twitter name of this user ''' return self._screen_name def SetScreenName(self, screen_name): '''Set the short twitter name of this user. Args: screen_name: the short twitter name of this user ''' self._screen_name = screen_name screen_name = property(GetScreenName, SetScreenName, doc='The short twitter name of this user.') def GetLocation(self): '''Get the geographic location of this user. Returns: The geographic location of this user ''' return self._location def SetLocation(self, location): '''Set the geographic location of this user. Args: location: The geographic location of this user ''' self._location = location location = property(GetLocation, SetLocation, doc='The geographic location of this user.') def GetDescription(self): '''Get the short text description of this user. Returns: The short text description of this user ''' return self._description def SetDescription(self, description): '''Set the short text description of this user. Args: description: The short text description of this user ''' self._description = description description = property(GetDescription, SetDescription, doc='The short text description of this user.') def GetUrl(self): '''Get the homepage url of this user. Returns: The homepage url of this user ''' return self._url def SetUrl(self, url): '''Set the homepage url of this user. Args: url: The homepage url of this user ''' self._url = url url = property(GetUrl, SetUrl, doc='The homepage url of this user.') def GetProfileImageUrl(self): '''Get the url of the thumbnail of this user. Returns: The url of the thumbnail of this user ''' return self._profile_image_url def SetProfileImageUrl(self, profile_image_url): '''Set the url of the thumbnail of this user. Args: profile_image_url: The url of the thumbnail of this user ''' self._profile_image_url = profile_image_url profile_image_url= property(GetProfileImageUrl, SetProfileImageUrl, doc='The url of the thumbnail of this user.') def GetProfileBackgroundTile(self): '''Boolean for whether to tile the profile background image. Returns: True if the background is to be tiled, False if not, None if unset. ''' return self._profile_background_tile def SetProfileBackgroundTile(self, profile_background_tile): '''Set the boolean flag for whether to tile the profile background image. Args: profile_background_tile: Boolean flag for whether to tile or not. ''' self._profile_background_tile = profile_background_tile profile_background_tile = property(GetProfileBackgroundTile, SetProfileBackgroundTile, doc='Boolean for whether to tile the background image.') def GetProfileBackgroundImageUrl(self): return self._profile_background_image_url def SetProfileBackgroundImageUrl(self, profile_background_image_url): self._profile_background_image_url = profile_background_image_url profile_background_image_url = property(GetProfileBackgroundImageUrl, SetProfileBackgroundImageUrl, doc='The url of the profile background of this user.') def GetProfileSidebarFillColor(self): return self._profile_sidebar_fill_color def SetProfileSidebarFillColor(self, profile_sidebar_fill_color): self._profile_sidebar_fill_color = profile_sidebar_fill_color profile_sidebar_fill_color = property(GetProfileSidebarFillColor, SetProfileSidebarFillColor) def GetProfileBackgroundColor(self): return self._profile_background_color def SetProfileBackgroundColor(self, profile_background_color): self._profile_background_color = profile_background_color profile_background_color = property(GetProfileBackgroundColor, SetProfileBackgroundColor) def GetProfileLinkColor(self): return self._profile_link_color def SetProfileLinkColor(self, profile_link_color): self._profile_link_color = profile_link_color profile_link_color = property(GetProfileLinkColor, SetProfileLinkColor) def GetProfileTextColor(self): return self._profile_text_color def SetProfileTextColor(self, profile_text_color): self._profile_text_color = profile_text_color profile_text_color = property(GetProfileTextColor, SetProfileTextColor) def GetProtected(self): return self._protected def SetProtected(self, protected): self._protected = protected protected = property(GetProtected, SetProtected) def GetUtcOffset(self): return self._utc_offset def SetUtcOffset(self, utc_offset): self._utc_offset = utc_offset utc_offset = property(GetUtcOffset, SetUtcOffset) def GetTimeZone(self): '''Returns the current time zone string for the user. Returns: The descriptive time zone string for the user. ''' return self._time_zone def SetTimeZone(self, time_zone): '''Sets the user's time zone string. Args: time_zone: The descriptive time zone to assign for the user. ''' self._time_zone = time_zone time_zone = property(GetTimeZone, SetTimeZone) def GetStatus(self): '''Get the latest twitter.Status of this user. Returns: The latest twitter.Status of this user ''' return self._status def SetStatus(self, status): '''Set the latest twitter.Status of this user. Args: status: The latest twitter.Status of this user ''' self._status = status status = property(GetStatus, SetStatus, doc='The latest twitter.Status of this user.') def GetFriendsCount(self): '''Get the friend count for this user. Returns: The number of users this user has befriended. ''' return self._friends_count def SetFriendsCount(self, count): '''Set the friend count for this user. Args: count: The number of users this user has befriended. ''' self._friends_count = count friends_count = property(GetFriendsCount, SetFriendsCount, doc='The number of friends for this user.') def GetListedCount(self): '''Get the listed count for this user. Returns: The number of lists this user belongs to. ''' return self._listed_count def SetListedCount(self, count): '''Set the listed count for this user. Args: count: The number of lists this user belongs to. ''' self._listed_count = count listed_count = property(GetListedCount, SetListedCount, doc='The number of lists this user belongs to.') def GetFollowersCount(self): '''Get the follower count for this user. Returns: The number of users following this user. ''' return self._followers_count def SetFollowersCount(self, count): '''Set the follower count for this user. Args: count: The number of users following this user. ''' self._followers_count = count followers_count = property(GetFollowersCount, SetFollowersCount, doc='The number of users following this user.') def GetStatusesCount(self): '''Get the number of status updates for this user. Returns: The number of status updates for this user. ''' return self._statuses_count def SetStatusesCount(self, count): '''Set the status update count for this user. Args: count: The number of updates for this user. ''' self._statuses_count = count statuses_count = property(GetStatusesCount, SetStatusesCount, doc='The number of updates for this user.') def GetFavouritesCount(self): '''Get the number of favourites for this user. Returns: The number of favourites for this user. ''' return self._favourites_count def SetFavouritesCount(self, count): '''Set the favourite count for this user. Args: count: The number of favourites for this user. ''' self._favourites_count = count favourites_count = property(GetFavouritesCount, SetFavouritesCount, doc='The number of favourites for this user.') def GetGeoEnabled(self): '''Get the setting of geo_enabled for this user. Returns: True/False if Geo tagging is enabled ''' return self._geo_enabled def SetGeoEnabled(self, geo_enabled): '''Set the latest twitter.geo_enabled of this user. Args: geo_enabled: True/False if Geo tagging is to be enabled ''' self._geo_enabled = geo_enabled geo_enabled = property(GetGeoEnabled, SetGeoEnabled, doc='The value of twitter.geo_enabled for this user.') def GetVerified(self): '''Get the setting of verified for this user. Returns: True/False if user is a verified account ''' return self._verified def SetVerified(self, verified): '''Set twitter.verified for this user. Args: verified: True/False if user is a verified account ''' self._verified = verified verified = property(GetVerified, SetVerified, doc='The value of twitter.verified for this user.') def GetLang(self): '''Get the setting of lang for this user. Returns: language code of the user ''' return self._lang def SetLang(self, lang): '''Set twitter.lang for this user. Args: lang: language code for the user ''' self._lang = lang lang = property(GetLang, SetLang, doc='The value of twitter.lang for this user.') def GetNotifications(self): '''Get the setting of notifications for this user. Returns: True/False for the notifications setting of the user ''' return self._notifications def SetNotifications(self, notifications): '''Set twitter.notifications for this user. Args: notifications: True/False notifications setting for the user ''' self._notifications = notifications notifications = property(GetNotifications, SetNotifications, doc='The value of twitter.notifications for this user.') def GetContributorsEnabled(self): '''Get the setting of contributors_enabled for this user. Returns: True/False contributors_enabled of the user ''' return self._contributors_enabled def SetContributorsEnabled(self, contributors_enabled): '''Set twitter.contributors_enabled for this user. Args: contributors_enabled: True/False contributors_enabled setting for the user ''' self._contributors_enabled = contributors_enabled contributors_enabled = property(GetContributorsEnabled, SetContributorsEnabled, doc='The value of twitter.contributors_enabled for this user.') def GetCreatedAt(self): '''Get the setting of created_at for this user. Returns: created_at value of the user ''' return self._created_at def SetCreatedAt(self, created_at): '''Set twitter.created_at for this user. Args: created_at: created_at value for the user ''' self._created_at = created_at created_at = property(GetCreatedAt, SetCreatedAt, doc='The value of twitter.created_at for this user.') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.id == other.id and \ self.name == other.name and \ self.screen_name == other.screen_name and \ self.location == other.location and \ self.description == other.description and \ self.profile_image_url == other.profile_image_url and \ self.profile_background_tile == other.profile_background_tile and \ self.profile_background_image_url == other.profile_background_image_url and \ self.profile_sidebar_fill_color == other.profile_sidebar_fill_color and \ self.profile_background_color == other.profile_background_color and \ self.profile_link_color == other.profile_link_color and \ self.profile_text_color == other.profile_text_color and \ self.protected == other.protected and \ self.utc_offset == other.utc_offset and \ self.time_zone == other.time_zone and \ self.url == other.url and \ self.statuses_count == other.statuses_count and \ self.followers_count == other.followers_count and \ self.favourites_count == other.favourites_count and \ self.friends_count == other.friends_count and \ self.status == other.status and \ self.geo_enabled == other.geo_enabled and \ self.verified == other.verified and \ self.lang == other.lang and \ self.notifications == other.notifications and \ self.contributors_enabled == other.contributors_enabled and \ self.created_at == other.created_at and \ self.listed_count == other.listed_count except AttributeError: return False def __str__(self): '''A string representation of this twitter.User instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.User instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.User instance. Returns: A JSON string representation of this twitter.User instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.User instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.User instance ''' data = {} if self.id: data['id'] = self.id if self.name: data['name'] = self.name if self.screen_name: data['screen_name'] = self.screen_name if self.location: data['location'] = self.location if self.description: data['description'] = self.description if self.profile_image_url: data['profile_image_url'] = self.profile_image_url if self.profile_background_tile is not None: data['profile_background_tile'] = self.profile_background_tile if self.profile_background_image_url: data['profile_sidebar_fill_color'] = self.profile_background_image_url if self.profile_background_color: data['profile_background_color'] = self.profile_background_color if self.profile_link_color: data['profile_link_color'] = self.profile_link_color if self.profile_text_color: data['profile_text_color'] = self.profile_text_color if self.protected is not None: data['protected'] = self.protected if self.utc_offset: data['utc_offset'] = self.utc_offset if self.time_zone: data['time_zone'] = self.time_zone if self.url: data['url'] = self.url if self.status: data['status'] = self.status.AsDict() if self.friends_count: data['friends_count'] = self.friends_count if self.followers_count: data['followers_count'] = self.followers_count if self.statuses_count: data['statuses_count'] = self.statuses_count if self.favourites_count: data['favourites_count'] = self.favourites_count if self.geo_enabled: data['geo_enabled'] = self.geo_enabled if self.verified: data['verified'] = self.verified if self.lang: data['lang'] = self.lang if self.notifications: data['notifications'] = self.notifications if self.contributors_enabled: data['contributors_enabled'] = self.contributors_enabled if self.created_at: data['created_at'] = self.created_at if self.listed_count: data['listed_count'] = self.listed_count return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.User instance ''' if 'status' in data: status = Status.NewFromJsonDict(data['status']) else: status = None return User(id=data.get('id', None), name=data.get('name', None), screen_name=data.get('screen_name', None), location=data.get('location', None), description=data.get('description', None), statuses_count=data.get('statuses_count', None), followers_count=data.get('followers_count', None), favourites_count=data.get('favourites_count', None), friends_count=data.get('friends_count', None), profile_image_url=data.get('profile_image_url', None), profile_background_tile = data.get('profile_background_tile', None), profile_background_image_url = data.get('profile_background_image_url', None), profile_sidebar_fill_color = data.get('profile_sidebar_fill_color', None), profile_background_color = data.get('profile_background_color', None), profile_link_color = data.get('profile_link_color', None), profile_text_color = data.get('profile_text_color', None), protected = data.get('protected', None), utc_offset = data.get('utc_offset', None), time_zone = data.get('time_zone', None), url=data.get('url', None), status=status, geo_enabled=data.get('geo_enabled', None), verified=data.get('verified', None), lang=data.get('lang', None), notifications=data.get('notifications', None), contributors_enabled=data.get('contributors_enabled', None), created_at=data.get('created_at', None), listed_count=data.get('listed_count', None)) class List(object): '''A class representing the List structure used by the twitter API. The List structure exposes the following properties: list.id list.name list.slug list.description list.full_name list.mode list.uri list.member_count list.subscriber_count list.following ''' def __init__(self, id=None, name=None, slug=None, description=None, full_name=None, mode=None, uri=None, member_count=None, subscriber_count=None, following=None, user=None): self.id = id self.name = name self.slug = slug self.description = description self.full_name = full_name self.mode = mode self.uri = uri self.member_count = member_count self.subscriber_count = subscriber_count self.following = following self.user = user def GetId(self): '''Get the unique id of this list. Returns: The unique id of this list ''' return self._id def SetId(self, id): '''Set the unique id of this list. Args: id: The unique id of this list. ''' self._id = id id = property(GetId, SetId, doc='The unique id of this list.') def GetName(self): '''Get the real name of this list. Returns: The real name of this list ''' return self._name def SetName(self, name): '''Set the real name of this list. Args: name: The real name of this list ''' self._name = name name = property(GetName, SetName, doc='The real name of this list.') def GetSlug(self): '''Get the slug of this list. Returns: The slug of this list ''' return self._slug def SetSlug(self, slug): '''Set the slug of this list. Args: slug: The slug of this list. ''' self._slug = slug slug = property(GetSlug, SetSlug, doc='The slug of this list.') def GetDescription(self): '''Get the description of this list. Returns: The description of this list ''' return self._description def SetDescription(self, description): '''Set the description of this list. Args: description: The description of this list. ''' self._description = description description = property(GetDescription, SetDescription, doc='The description of this list.') def GetFull_name(self): '''Get the full_name of this list. Returns: The full_name of this list ''' return self._full_name def SetFull_name(self, full_name): '''Set the full_name of this list. Args: full_name: The full_name of this list. ''' self._full_name = full_name full_name = property(GetFull_name, SetFull_name, doc='The full_name of this list.') def GetMode(self): '''Get the mode of this list. Returns: The mode of this list ''' return self._mode def SetMode(self, mode): '''Set the mode of this list. Args: mode: The mode of this list. ''' self._mode = mode mode = property(GetMode, SetMode, doc='The mode of this list.') def GetUri(self): '''Get the uri of this list. Returns: The uri of this list ''' return self._uri def SetUri(self, uri): '''Set the uri of this list. Args: uri: The uri of this list. ''' self._uri = uri uri = property(GetUri, SetUri, doc='The uri of this list.') def GetMember_count(self): '''Get the member_count of this list. Returns: The member_count of this list ''' return self._member_count def SetMember_count(self, member_count): '''Set the member_count of this list. Args: member_count: The member_count of this list. ''' self._member_count = member_count member_count = property(GetMember_count, SetMember_count, doc='The member_count of this list.') def GetSubscriber_count(self): '''Get the subscriber_count of this list. Returns: The subscriber_count of this list ''' return self._subscriber_count def SetSubscriber_count(self, subscriber_count): '''Set the subscriber_count of this list. Args: subscriber_count: The subscriber_count of this list. ''' self._subscriber_count = subscriber_count subscriber_count = property(GetSubscriber_count, SetSubscriber_count, doc='The subscriber_count of this list.') def GetFollowing(self): '''Get the following status of this list. Returns: The following status of this list ''' return self._following def SetFollowing(self, following): '''Set the following status of this list. Args: following: The following of this list. ''' self._following = following following = property(GetFollowing, SetFollowing, doc='The following status of this list.') def GetUser(self): '''Get the user of this list. Returns: The owner of this list ''' return self._user def SetUser(self, user): '''Set the user of this list. Args: user: The owner of this list. ''' self._user = user user = property(GetUser, SetUser, doc='The owner of this list.') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.id == other.id and \ self.name == other.name and \ self.slug == other.slug and \ self.description == other.description and \ self.full_name == other.full_name and \ self.mode == other.mode and \ self.uri == other.uri and \ self.member_count == other.member_count and \ self.subscriber_count == other.subscriber_count and \ self.following == other.following and \ self.user == other.user except AttributeError: return False def __str__(self): '''A string representation of this twitter.List instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.List instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.List instance. Returns: A JSON string representation of this twitter.List instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.List instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.List instance ''' data = {} if self.id: data['id'] = self.id if self.name: data['name'] = self.name if self.slug: data['slug'] = self.slug if self.description: data['description'] = self.description if self.full_name: data['full_name'] = self.full_name if self.mode: data['mode'] = self.mode if self.uri: data['uri'] = self.uri if self.member_count is not None: data['member_count'] = self.member_count if self.subscriber_count is not None: data['subscriber_count'] = self.subscriber_count if self.following is not None: data['following'] = self.following if self.user is not None: data['user'] = self.user return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.List instance ''' if 'user' in data: user = User.NewFromJsonDict(data['user']) else: user = None return List(id=data.get('id', None), name=data.get('name', None), slug=data.get('slug', None), description=data.get('description', None), full_name=data.get('full_name', None), mode=data.get('mode', None), uri=data.get('uri', None), member_count=data.get('member_count', None), subscriber_count=data.get('subscriber_count', None), following=data.get('following', None), user=user) class DirectMessage(object): '''A class representing the DirectMessage structure used by the twitter API. The DirectMessage structure exposes the following properties: direct_message.id direct_message.created_at direct_message.created_at_in_seconds # read only direct_message.sender_id direct_message.sender_screen_name direct_message.recipient_id direct_message.recipient_screen_name direct_message.text ''' def __init__(self, id=None, created_at=None, sender_id=None, sender_screen_name=None, recipient_id=None, recipient_screen_name=None, text=None): '''An object to hold a Twitter direct message. This class is normally instantiated by the twitter.Api class and returned in a sequence. Note: Dates are posted in the form "Sat Jan 27 04:17:38 +0000 2007" Args: id: The unique id of this direct message. [Optional] created_at: The time this direct message was posted. [Optional] sender_id: The id of the twitter user that sent this message. [Optional] sender_screen_name: The name of the twitter user that sent this message. [Optional] recipient_id: The id of the twitter that received this message. [Optional] recipient_screen_name: The name of the twitter that received this message. [Optional] text: The text of this direct message. [Optional] ''' self.id = id self.created_at = created_at self.sender_id = sender_id self.sender_screen_name = sender_screen_name self.recipient_id = recipient_id self.recipient_screen_name = recipient_screen_name self.text = text def GetId(self): '''Get the unique id of this direct message. Returns: The unique id of this direct message ''' return self._id def SetId(self, id): '''Set the unique id of this direct message. Args: id: The unique id of this direct message ''' self._id = id id = property(GetId, SetId, doc='The unique id of this direct message.') def GetCreatedAt(self): '''Get the time this direct message was posted. Returns: The time this direct message was posted ''' return self._created_at def SetCreatedAt(self, created_at): '''Set the time this direct message was posted. Args: created_at: The time this direct message was created ''' self._created_at = created_at created_at = property(GetCreatedAt, SetCreatedAt, doc='The time this direct message was posted.') def GetCreatedAtInSeconds(self): '''Get the time this direct message was posted, in seconds since the epoch. Returns: The time this direct message was posted, in seconds since the epoch. ''' return calendar.timegm(rfc822.parsedate(self.created_at)) created_at_in_seconds = property(GetCreatedAtInSeconds, doc="The time this direct message was " "posted, in seconds since the epoch") def GetSenderId(self): '''Get the unique sender id of this direct message. Returns: The unique sender id of this direct message ''' return self._sender_id def SetSenderId(self, sender_id): '''Set the unique sender id of this direct message. Args: sender_id: The unique sender id of this direct message ''' self._sender_id = sender_id sender_id = property(GetSenderId, SetSenderId, doc='The unique sender id of this direct message.') def GetSenderScreenName(self): '''Get the unique sender screen name of this direct message. Returns: The unique sender screen name of this direct message ''' return self._sender_screen_name def SetSenderScreenName(self, sender_screen_name): '''Set the unique sender screen name of this direct message. Args: sender_screen_name: The unique sender screen name of this direct message ''' self._sender_screen_name = sender_screen_name sender_screen_name = property(GetSenderScreenName, SetSenderScreenName, doc='The unique sender screen name of this direct message.') def GetRecipientId(self): '''Get the unique recipient id of this direct message. Returns: The unique recipient id of this direct message ''' return self._recipient_id def SetRecipientId(self, recipient_id): '''Set the unique recipient id of this direct message. Args: recipient_id: The unique recipient id of this direct message ''' self._recipient_id = recipient_id recipient_id = property(GetRecipientId, SetRecipientId, doc='The unique recipient id of this direct message.') def GetRecipientScreenName(self): '''Get the unique recipient screen name of this direct message. Returns: The unique recipient screen name of this direct message ''' return self._recipient_screen_name def SetRecipientScreenName(self, recipient_screen_name): '''Set the unique recipient screen name of this direct message. Args: recipient_screen_name: The unique recipient screen name of this direct message ''' self._recipient_screen_name = recipient_screen_name recipient_screen_name = property(GetRecipientScreenName, SetRecipientScreenName, doc='The unique recipient screen name of this direct message.') def GetText(self): '''Get the text of this direct message. Returns: The text of this direct message. ''' return self._text def SetText(self, text): '''Set the text of this direct message. Args: text: The text of this direct message ''' self._text = text text = property(GetText, SetText, doc='The text of this direct message') def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.id == other.id and \ self.created_at == other.created_at and \ self.sender_id == other.sender_id and \ self.sender_screen_name == other.sender_screen_name and \ self.recipient_id == other.recipient_id and \ self.recipient_screen_name == other.recipient_screen_name and \ self.text == other.text except AttributeError: return False def __str__(self): '''A string representation of this twitter.DirectMessage instance. The return value is the same as the JSON string representation. Returns: A string representation of this twitter.DirectMessage instance. ''' return self.AsJsonString() def AsJsonString(self): '''A JSON string representation of this twitter.DirectMessage instance. Returns: A JSON string representation of this twitter.DirectMessage instance ''' return simplejson.dumps(self.AsDict(), sort_keys=True) def AsDict(self): '''A dict representation of this twitter.DirectMessage instance. The return value uses the same key names as the JSON representation. Return: A dict representing this twitter.DirectMessage instance ''' data = {} if self.id: data['id'] = self.id if self.created_at: data['created_at'] = self.created_at if self.sender_id: data['sender_id'] = self.sender_id if self.sender_screen_name: data['sender_screen_name'] = self.sender_screen_name if self.recipient_id: data['recipient_id'] = self.recipient_id if self.recipient_screen_name: data['recipient_screen_name'] = self.recipient_screen_name if self.text: data['text'] = self.text return data @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.DirectMessage instance ''' return DirectMessage(created_at=data.get('created_at', None), recipient_id=data.get('recipient_id', None), sender_id=data.get('sender_id', None), text=data.get('text', None), sender_screen_name=data.get('sender_screen_name', None), id=data.get('id', None), recipient_screen_name=data.get('recipient_screen_name', None)) class Hashtag(object): ''' A class represeinting a twitter hashtag ''' def __init__(self, text=None): self.text = text @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Hashtag instance ''' return Hashtag(text = data.get('text', None)) class Trend(object): ''' A class representing a trending topic ''' def __init__(self, name=None, query=None, timestamp=None): self.name = name self.query = query self.timestamp = timestamp def __str__(self): return 'Name: %s\nQuery: %s\nTimestamp: %s\n' % (self.name, self.query, self.timestamp) def __ne__(self, other): return not self.__eq__(other) def __eq__(self, other): try: return other and \ self.name == other.name and \ self.query == other.query and \ self.timestamp == other.timestamp except AttributeError: return False @staticmethod def NewFromJsonDict(data, timestamp = None): '''Create a new instance based on a JSON dict Args: data: A JSON dict timestamp: Gets set as the timestamp property of the new object Returns: A twitter.Trend object ''' return Trend(name=data.get('name', None), query=data.get('query', None), timestamp=timestamp) class Url(object): '''A class representing an URL contained in a tweet''' def __init__(self, url=None, expanded_url=None): self.url = url self.expanded_url = expanded_url @staticmethod def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.Url instance ''' return Url(url=data.get('url', None), expanded_url=data.get('expanded_url', None)) class Api(object): '''A python interface into the Twitter API By default, the Api caches results for 1 minute. Example usage: To create an instance of the twitter.Api class, with no authentication: >>> import twitter >>> api = twitter.Api() To fetch the most recently posted public twitter status messages: >>> statuses = api.GetPublicTimeline() >>> print [s.user.name for s in statuses] [u'DeWitt', u'Kesuke Miyagi', u'ev', u'Buzz Andersen', u'Biz Stone'] #... To fetch a single user's public status messages, where "user" is either a Twitter "short name" or their user id. >>> statuses = api.GetUserTimeline(user) >>> print [s.text for s in statuses] To use authentication, instantiate the twitter.Api class with a consumer key and secret; and the oAuth key and secret: >>> api = twitter.Api(consumer_key='twitter consumer key', consumer_secret='twitter consumer secret', access_token_key='the_key_given', access_token_secret='the_key_secret') To fetch your friends (after being authenticated): >>> users = api.GetFriends() >>> print [u.name for u in users] To post a twitter status message (after being authenticated): >>> status = api.PostUpdate('I love python-twitter!') >>> print status.text I love python-twitter! There are many other methods, including: >>> api.PostUpdates(status) >>> api.PostDirectMessage(user, text) >>> api.GetUser(user) >>> api.GetReplies() >>> api.GetUserTimeline(user) >>> api.GetStatus(id) >>> api.DestroyStatus(id) >>> api.GetFriendsTimeline(user) >>> api.GetFriends(user) >>> api.GetFollowers() >>> api.GetFeatured() >>> api.GetDirectMessages() >>> api.PostDirectMessage(user, text) >>> api.DestroyDirectMessage(id) >>> api.DestroyFriendship(user) >>> api.CreateFriendship(user) >>> api.GetUserByEmail(email) >>> api.VerifyCredentials() ''' DEFAULT_CACHE_TIMEOUT = 60 # cache for 1 minute _API_REALM = 'Twitter API' def __init__(self, consumer_key=None, consumer_secret=None, access_token_key=None, access_token_secret=None, input_encoding=None, request_headers=None, cache=DEFAULT_CACHE, shortner=None, base_url=None, use_gzip_compression=False, debugHTTP=False): '''Instantiate a new twitter.Api object. Args: consumer_key: Your Twitter user's consumer_key. consumer_secret: Your Twitter user's consumer_secret. access_token_key: The oAuth access token key value you retrieved from running get_access_token.py. access_token_secret: The oAuth access token's secret, also retrieved from the get_access_token.py run. input_encoding: The encoding used to encode input strings. [Optional] request_header: A dictionary of additional HTTP request headers. [Optional] cache: The cache instance to use. Defaults to DEFAULT_CACHE. Use None to disable caching. [Optional] shortner: The shortner instance to use. Defaults to None. See shorten_url.py for an example shortner. [Optional] base_url: The base URL to use to contact the Twitter API. Defaults to https://twitter.com. [Optional] use_gzip_compression: Set to True to tell enable gzip compression for any call made to Twitter. Defaults to False. [Optional] debugHTTP: Set to True to enable debug output from urllib2 when performing any HTTP requests. Defaults to False. [Optional] ''' self.SetCache(cache) self._urllib = urllib2 self._cache_timeout = Api.DEFAULT_CACHE_TIMEOUT self._input_encoding = input_encoding self._use_gzip = use_gzip_compression self._debugHTTP = debugHTTP self._oauth_consumer = None self._InitializeRequestHeaders(request_headers) self._InitializeUserAgent() self._InitializeDefaultParameters() if base_url is None: self.base_url = 'https://api.twitter.com/1' else: self.base_url = base_url if consumer_key is not None and (access_token_key is None or access_token_secret is None): print >> sys.stderr, 'Twitter now requires an oAuth Access Token for API calls.' print >> sys.stderr, 'If your using this library from a command line utility, please' print >> sys.stderr, 'run the the included get_access_token.py tool to generate one.' raise TwitterError('Twitter requires oAuth Access Token for all API access') self.SetCredentials(consumer_key, consumer_secret, access_token_key, access_token_secret) def SetCredentials(self, consumer_key, consumer_secret, access_token_key=None, access_token_secret=None): '''Set the consumer_key and consumer_secret for this instance Args: consumer_key: The consumer_key of the twitter account. consumer_secret: The consumer_secret for the twitter account. access_token_key: The oAuth access token key value you retrieved from running get_access_token.py. access_token_secret: The oAuth access token's secret, also retrieved from the get_access_token.py run. ''' self._consumer_key = consumer_key self._consumer_secret = consumer_secret self._access_token_key = access_token_key self._access_token_secret = access_token_secret self._oauth_consumer = None if consumer_key is not None and consumer_secret is not None and \ access_token_key is not None and access_token_secret is not None: self._signature_method_plaintext = oauth.SignatureMethod_PLAINTEXT() self._signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() self._oauth_token = oauth.Token(key=access_token_key, secret=access_token_secret) self._oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret) def ClearCredentials(self): '''Clear the any credentials for this instance ''' self._consumer_key = None self._consumer_secret = None self._access_token_key = None self._access_token_secret = None self._oauth_consumer = None def GetPublicTimeline(self, since_id=None, include_rts=None, include_entities=None): '''Fetch the sequence of public twitter.Status message for all users. Args: since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] include_rts: If True, the timeline will contain native retweets (if they exist) in addition to the standard stream of tweets. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: An sequence of twitter.Status instances, one for each message ''' parameters = {} if since_id: parameters['since_id'] = since_id if include_rts: parameters['include_rts'] = 1 if include_entities: parameters['include_entities'] = 1 url = '%s/statuses/public_timeline.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def FilterPublicTimeline(self, term, since_id=None): '''Filter the public twitter timeline by a given search term on the local machine. Args: term: term to search by. since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] Returns: A sequence of twitter.Status instances, one for each message containing the term ''' statuses = self.GetPublicTimeline(since_id) results = [] for s in statuses: if s.text.lower().find(term.lower()) != -1: results.append(s) return results def GetSearch(self, term=None, geocode=None, since_id=None, per_page=15, page=1, lang="en", show_user="true", query_users=False): '''Return twitter search results for a given term. Args: term: term to search by. Optional if you include geocode. since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] geocode: geolocation information in the form (latitude, longitude, radius) [Optional] per_page: number of results to return. Default is 15 [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] lang: language for results. Default is English [Optional] show_user: prefixes screen name in status query_users: If set to False, then all users only have screen_name and profile_image_url available. If set to True, all information of users are available, but it uses lots of request quota, one per status. Returns: A sequence of twitter.Status instances, one for each message containing the term ''' # Build request parameters parameters = {} if since_id: parameters['since_id'] = since_id if term is None and geocode is None: return [] if term is not None: parameters['q'] = term if geocode is not None: parameters['geocode'] = ','.join(map(str, geocode)) parameters['show_user'] = show_user parameters['lang'] = lang parameters['rpp'] = per_page parameters['page'] = page # Make and send requests url = 'http://search.twitter.com/search.json' json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) results = [] for x in data['results']: temp = Status.NewFromJsonDict(x) if query_users: # Build user object with new request temp.user = self.GetUser(urllib.quote(x['from_user'])) else: temp.user = User(screen_name=x['from_user'], profile_image_url=x['profile_image_url']) results.append(temp) # Return built list of statuses return results # [Status.NewFromJsonDict(x) for x in data['results']] def GetTrendsCurrent(self, exclude=None): '''Get the current top trending topics Args: exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 10 entries. Each entry contains the twitter. ''' parameters = {} if exclude: parameters['exclude'] = exclude url = '%s/trends/current.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] for t in data['trends']: for item in data['trends'][t]: trends.append(Trend.NewFromJsonDict(item, timestamp = t)) return trends def GetTrendsWoeid(self, woeid, exclude=None): '''Return the top 10 trending topics for a specific WOEID, if trending information is available for it. Args: woeid: the Yahoo! Where On Earth ID for a location. exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 10 entries. Each entry contains a Trend. ''' parameters = {} if exclude: parameters['exclude'] = exclude url = '%s/trends/%s.json' % (self.base_url, woeid) json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] timestamp = data[0]['as_of'] for trend in data[0]['trends']: trends.append(Trend.NewFromJsonDict(trend, timestamp = timestamp)) return trends def GetTrendsDaily(self, exclude=None, startdate=None): '''Get the current top trending topics for each hour in a given day Args: startdate: The start date for the report. Should be in the format YYYY-MM-DD. [Optional] exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with 24 entries. Each entry contains the twitter. Trend elements that were trending at the corresponding hour of the day. ''' parameters = {} if exclude: parameters['exclude'] = exclude if not startdate: startdate = time.strftime('%Y-%m-%d', time.gmtime()) parameters['date'] = startdate url = '%s/trends/daily.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] for i in xrange(24): trends.append(None) for t in data['trends']: idx = int(time.strftime('%H', time.strptime(t, '%Y-%m-%d %H:%M'))) trends[idx] = [Trend.NewFromJsonDict(x, timestamp = t) for x in data['trends'][t]] return trends def GetTrendsWeekly(self, exclude=None, startdate=None): '''Get the top 30 trending topics for each day in a given week. Args: startdate: The start date for the report. Should be in the format YYYY-MM-DD. [Optional] exclude: Appends the exclude parameter as a request parameter. Currently only exclude=hashtags is supported. [Optional] Returns: A list with each entry contains the twitter. Trend elements of trending topics for the corrsponding day of the week ''' parameters = {} if exclude: parameters['exclude'] = exclude if not startdate: startdate = time.strftime('%Y-%m-%d', time.gmtime()) parameters['date'] = startdate url = '%s/trends/weekly.json' % self.base_url json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) trends = [] for i in xrange(7): trends.append(None) # use the epochs of the dates as keys for a dictionary times = dict([(calendar.timegm(time.strptime(t, '%Y-%m-%d')),t) for t in data['trends']]) cnt = 0 # create the resulting structure ordered by the epochs of the dates for e in sorted(times.keys()): trends[cnt] = [Trend.NewFromJsonDict(x, timestamp = times[e]) for x in data['trends'][times[e]]] cnt +=1 return trends def GetFriendsTimeline(self, user=None, count=None, page=None, since_id=None, retweets=None, include_entities=None): '''Fetch the sequence of twitter.Status messages for a user's friends The twitter.Api instance must be authenticated if the user is private. Args: user: Specifies the ID or screen name of the user for whom to return the friends_timeline. If not specified then the authenticated user set in the twitter.Api instance will be used. [Optional] count: Specifies the number of statuses to retrieve. May not be greater than 100. [Optional] page: Specifies the page of results to retrieve. Note: there are pagination limits. [Optional] since_id: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available. [Optional] retweets: If True, the timeline will contain native retweets. [Optional] include_entities: If True, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. [Optional] Returns: A sequence of twitter.Status instances, one for each message ''' if not user and not self._oauth_consumer: raise TwitterError("User must be specified if API is not authenticated.") url = '%s/statuses/friends_timeline' % self.base_url if user: url = '%s/%s.json' % (url, user) else: url = '%s.json' % url parameters = {} if count is not None: try: if int(count) > 100: raise TwitterError("'count' may not be greater than 100") except ValueError: raise TwitterError("'count' must be an integer") parameters['count'] = count if page is not None: try: parameters['page'] = int(page) except ValueError: raise TwitterError("'page' must be an integer") if since_id: parameters['since_id'] = since_id if retweets: parameters['include_rts'] = True if include_entities: parameters['include_entities'] = True json = self._FetchUrl(url, parameters=parameters) data = self._ParseAndCheckTwitter(json) return [Status.NewFromJsonDict(x) for x in data] def GetUserTimeline(self, id=None, user_id=None, screen_name=None, since_id=None, max_id=None, count=None, page=None, include_rts=None, include_entities=None): '''Fetch the sequence of public Status messages for a single user. The twitter.Api instance must be authenticated if the user is private. Args: id: Specifies the ID or screen name of the user for whom to return the user_timeline. [Optional] user_id: Specfies the ID of the user for whom to return the user_timeline. Helpful for disambiguating when a valid user ID is also a valid screen name. [Optional] screen_name: Specfies the scre
KoiOates / Plover Dict CommandsNo description available
matt-snider / Dict.ccA command line interface tool for accessing dict.cc written in Haskell.
rajaryan / FDR Is Not Supported On This Devicelibi error on 6G device Setting to interface 0:0 WARNING: set interface failed, error -8 Recovery Mode Environment: iBoot build-version=iBoot-2817.60.2 iBoot build-style=RELEASE Sending AppleLogo... DEBUG: tss_response_get_path_by_entry: No entry 'AppleLogo' in TSS response NOTE: No path for component AppleLogo in TSS, will fetch from build_identity Extracting applelogo@2x~iphone.t7000.im4p... Writing data to AppleLogo Sending AppleLogo (12140 bytes)... DEBUG: tss_response_get_path_by_entry: No entry 'RestoreRamDisk' in TSS response NOTE: No path for component RestoreRamDisk in TSS, will fetch from build_identity Extracting 058-49166-036.dmg... Writing data to RestoreRamDisk Sending RestoreRamDisk (24208893 bytes)... DEBUG: tss_response_get_path_by_entry: No entry 'RestoreDeviceTree' in TSS response NOTE: No path for component RestoreDeviceTree in TSS, will fetch from build_identity Extracting DeviceTree.n61ap.im4p... Writing data to RestoreDeviceTree Sending RestoreDeviceTree (122870 bytes)... DEBUG: tss_response_get_path_by_entry: No entry 'RestoreKernelCache' in TSS response NOTE: No path for component RestoreKernelCache in TSS, will fetch from build_identity Extracting kernelcache.release.n61... Writing data to RestoreKernelCache Sending RestoreKernelCache (12023621 bytes)... About to restore device... Waiting for device... Attempt 1 to connect to restore mode device... Attempt 2 to connect to restore mode device... Attempt 3 to connect to restore mode device... Attempt 4 to connect to restore mode device... Attempt 5 to connect to restore mode device... Attempt 6 to connect to restore mode device... restore_is_current_device: Connected to com.apple.mobile.restored, version 13 Attempt 7 to connect to restore mode device... Device is now connected in restore mode... Connecting now... Connected to com.apple.mobile.restored, version 13 Device has successfully entered restore mode Hardware Information: BoardID: 6 ChipID: 28672 UniqueChipID: 7992728590225446 ProductionMode: true Previous restore exit status: 0x100 About to send NORData... DEBUG: tss_response_get_path_by_entry: No entry 'LLB' in TSS response NOTE: Could not get LLB path from TSS data, will fetch from build identity Found firmware path Firmware/all_flash/all_flash.n61ap.production Getting firmware manifest Firmware/all_flash/all_flash.n61ap.production/manifest Extracting LLB.n61.RELEASE.im4p... Writing data to LLB Extracting iBoot.n61.RELEASE.im4p... Writing data to iBoot Extracting DeviceTree.n61ap.im4p... Writing data to DeviceTree Extracting applelogo@2x~iphone.t7000.im4p... Writing data to AppleLogo Extracting recoverymode@1334~iphone-lightning.t7000.im4p... Writing data to RecoveryMode Extracting batterylow0@2x~iphone.t7000.im4p... Writing data to BatteryLow0 Extracting batterylow1@2x~iphone.t7000.im4p... Writing data to BatteryLow1 Extracting batterycharging0@2x~iphone.t7000.im4p... Writing data to BatteryCharging0 Extracting batterycharging1@2x~iphone.t7000.im4p... Writing data to BatteryCharging1 Extracting glyphplugin@1334~iphone-lightning.t7000.im4p... Writing data to BatteryPlugin Extracting batteryfull@2x~iphone.t7000.im4p... Writing data to BatteryFull Extracting sep-firmware.n61.RELEASE.im4p... Writing data to RestoreSEP Extracting sep-firmware.n61.RELEASE.im4p... Writing data to SEP common.c:supressed printing 14481617 bytes plist... Sending NORData now... Done sending NORData About to send RootTicket... Sending RootTicket now... Done sending RootTicket Partition NAND device (28) About to send FDR Trust data... Sending FDR Trust data now... Done sending FDR Trust Data Got status message Status: Disk Failure Log is available: SYSLOG: Sep 10 05:16:50 localhost bootlog[0] <Notice>: BOOT_TIME 1473484610 0 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: obe iDAC=1973 default SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleOscarProcessor::OscarStartGated: baudRate=0 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleOscarProcessor::setOscarStateGated: setting oscar-state=10001 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleOscarProcessor::publishFirmware: firmware published successfu lly SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleOscarProcessor::OscarBootGated: Starting Oscar2, baudRate=150 0000 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: ready - 00000000: 3f | ? SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleOscarProcessor::WaitForBootROMReady: _BootROMReady=1 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleOscarFirmware::waitForFirmwareImage: waiting for firmware SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleARMPMUCharger: AppleUSBCableDetect 0 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleARMPMUCharger: AppleUSBCableType Detached SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: ASPStorage::ASPIsReadOnly - Ramdisk rooted. Returning readonly tru e SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: ASPStorage::ASPIsReadOnly - Ramdisk rooted. Returning readonly tru e SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: LwVM::probe - failed to read header from media SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [effaceable:INIT] found current generation, 116, in group 0 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [effaceable:INIT] started SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: ASPStorage::ASPIsReadOnly - Ramdisk rooted. Returning readonly tru e SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [ANS syslog: nand] Util_Host:attempting to read element=PANICLOG n ot yet written, returning ERR_ABORT SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: LwVM::probe - failed to read header from media SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [ANS syslog: nand] Util_Host:attempting to read element=PANICLOG n ot yet written, returning ERR_ABORT SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [ANS syslog: nand] Util_Host:attempting to read element=PANICLOG n ot yet written, returning ERR_ABORT SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [ANS syslog: nand] Util_Host:attempting to read element=PANICLOG n ot yet written, returning ERR_ABORT SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleMesa::start: sensor sanity checking failed on start, power cy cle SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleARMPMUCharger: AppleUSBCableDetect 1 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleARMPMUCharger: AppleUSBCableType USBHost SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleMultitouchN1SPI: detected HBPP. driver will be kept alive SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [ PCI configuration begin ] SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: [ PCI configuration end, bridges 2, devices 1 ] SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.470793 wlan0.C[0] setPowerStateGated@7234:Power transition before init (Off --> On) SYSLOG: Sep 10 05:16:51 localhost syslogd[4] <Notice>: ASL Sender Statistics SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleMesa::start: sensor sanity checking failed on start, power cy cle SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.562630 wlan0.C[1] start@807:Waiting for PCIe to enumerate SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.563076 wlan0.A[2] createFirmwareLogger@8240: CCFlags: 0x0, CCLevel: 127 ConsoleFlags: 0x0, ConsoleLevel: -1 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleBCMWLANCore::init IO80211-177.6 "IO80211-177.6" Aug 19 2016 1 0:48:47 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: IO80211Controller::createIOReporters 0xc2851a7e587864e5 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: CCFlags: 0x0, CCLevel: 5 ConsoleFlags: 0x0, ConsoleLevel: -1 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: No Service found 10000039d SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: configureInterests - nElements <= 0!Failed to addSubscription for group Chip subgroup Bytes Transferred driver 0xc2851a7e587864e5 - data underrun SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: IO80211ControllerMonitor::configureSubscriptions() failed to add s ubscriptionIO80211Controller::start _controller is 0xc2851a7e587864e5, provider is 0xc2851a7f6e0f64e5 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.565214 wlan0.A[3] gatherDeviceTreeData@774:WiFi 'serial bau d rate' is invalid! SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.566806 wlan0.N[4] start@1179:Starting with MAC Address: 70: 3e:ac:5d:ee:47 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleBCMWLANCore::apple80211RequestIoctl type 0xc cmd GET SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleBCMWLANCore::apple80211RequestIoctl type 0x50 cmd GET SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.566907 wlan0.N[5] setPowerStateGated@15307: powerState 1, fStateFlags 0x20, dev 0xc2851a7e587864e5 (this 1, provider 0) SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.566911 wlan0.N[6] setPowerStateGated@15310: Received power state change before driver has initialized, ignoring SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: IO80211PeerManager::initWithInterface can't add monitoring timer SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: IO80211Interface::init peerManager=0xc2851a7f6e2a24e5 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: IO80211Controller::configureInterface: Setting mac address on inte rface SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.568941 wlan0.N[7] populateRequestedFiles@1299:FW C-4345__s- B1/tempranillo.trx SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.568975 wlan0.N[8] populateRequestedFiles@1305:CLM C-4345__s -B1/tempranillo.clmb SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.568987 wlan0.N[9] populateRequestedFiles@1313:Tx Cap C-4345 __s-B1/tempranillo.txcb SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: 000026.568993 wlan0.N[10] populateRequestedFiles@1326:NVRAM C-4345 __s-B1/P-tempranillo_M-CORO_V-m__m-5.1.txt SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_handleUSBCableConnect cable connect ed, but don't have device configuration yet unable to open /dev/klog: Resource busy SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:154: couldn't load supp ort library SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:520: _MGSCopyAnswerFrom Server can't be loaded SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:124: called dummy funct ion! display-scale = 2 display-rotation = 0 found applelogo at /usr/share/progressui/applelogo@2x.tga SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: IOMFB: /System/Library/Frameworks/MediaToolbox.framework /MediaToolbox not found SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: IOMFB: /System/Library/PrivateFrameworks/MediaToolbox.fr amework/MediaToolbox not found SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: IOMFB: /System/Library/PrivateFrameworks/Celestial.frame work/Celestial not found SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: IOMFB: FigInstallVirtualDisplay not found SYSLOG: Sep 10 05:16:51 localhost restored_external[6] <Error>: CFPreferences could not connect to its daemon. Preferences using the connection 0x0 will be volatile and will not be persisted to disk. found display: primary display: 750 x 1334 powering on display SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: Loading diags data region 1 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device - Configuration: Apple Mobile Device SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device Interface: AppleUSBMux waiting for matching IOKit service: <CFBasicHash 0x15550bbb0 [0x100bf2a08]>{type = mutable dict, count = 1, entries => 0 : <CFString 0x100e7ef10 [0x100bf2a08]>{contents = "IOProviderClass"} = <CFString 0x15550bca0 [0x100bf2a08]>{co ntents = "AppleUSBDeviceMux"} } SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: virtual bool AppleUSBDeviceMux::start(IOService *) build: Aug 19 2 016 10:50:21 SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::gated_registerFunction Register function AppleUSBMux SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleSynopsysOTG3Device::startUSBStack Starting usb stack SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleMesa::start: disabling the sensor SYSLOG: Sep 10 05:16:51 localhost kernel[0] <Notice>: AppleDRV2604Vibrator::start() mode=rtp cal=0a:67:a5:01 init=0 SYSLOG: Sep 10 05:16:54 localhost kernel[0] <Notice>: IOReturn AppleUSBDeviceMux::setPropertiesGated(OSObject *) setting debug level to 7 recv(9, 4) failed: connection closed unable to read message size: -1 could not receive message recv(9, 4) failed: connection closed recv(10, 4) failed: connection closed unable to read message size: -1 unable to read message size: -1 could not receive message could not receive message recv(14, 4) failed: connection closed recv(15, 4) failed: connection closed recv(9, 4) failed: connection closed recv(12, 4) failed: connection closed recv(11, 4) failed: connection closed unable to read message size: -1 recv(16, 4) failed: connection closed unable to read message size: -1 recv(13, 4) failed: connection closed unable to read message size: -1 unable to read message size: -1 unable to read message size: -1 could not receive message unable to read message size: -1 could not receive message recv(18, 4) failed: connection closed unable to read message size: -1 recv(19, 4) failed: connection closed could not receive message could not receive message could not receive message recv(20, 4) failed: connection closed recv(21, 4) failed: connection closed could not receive message recv(22, 4) failed: connection closed recv(14, 4) failed: connection closed unable to read message size: -1 could not receive message unable to read message size: -1 unable to read message size: -1 unable to read message size: -1 unable to read message size: -1 unable to read message size: -1 could not receive message could not receive message could not receive message could not receive message could not receive message could not receive message client protocol version 13 *** UUID 9A713E8C-8EC4-6F52-5B83-A150C021547E *** Restore options: MinimumSystemPartition => <CFNumber 0xb00000000000a9f3 [0x100bf2a08]>{value = +2719, type = kCFNumberSIn t64Type} UUID => <CFString 0x15560ac00 [0x100bf2a08]>{contents = "9A713E8C-8EC4-6F52-5B83-A150C 021547E"} SystemPartitionSize => <CFNumber 0xb00000000000a9f3 [0x100bf2a08]>{value = +2719, type = kCFNumberSIn t64Type} SystemPartitionPadding => <CFBasicHash 0x15560aa10 [0x100bf2a08]>{type = mutable dict, count = 9, entries => 0 : <CFString 0x1556071f0 [0x100bf2a08]>{contents = "512"} = <CFNumber 0xb000000000005003 [0x100bf2a08]>{value = +1280, type = kCFNumberSInt64Type} 2 : <CFString 0x155606670 [0x100bf2a08]>{contents = "128"} = <CFNumber 0xb000000000005003 [0x100bf2a08]>{value = +1280, type = kCFNumberSInt64Type} 3 : <CFString 0x155603160 [0x100bf2a08]>{contents = "16"} = <CFNumber 0xb000000000000a03 [0x100bf2a08]>{value = +160, type = kCFNumberSInt64Type} 4 : <CFString 0x15560b530 [0x100bf2a08]>{contents = "1024"} = <CFNumber 0xb000000000005003 [0x100bf2a08]>{value = +1280, type = kCFNumberSInt64Type} 5 : <CFString 0x15560b4f0 [0x100bf2a08]>{contents = "32"} = <CFNumber 0xb000000000001403 [0x100bf2a08]>{value = +320, type = kCFNumberSInt64Type} 6 : <CFString 0x155600330 [0x100bf2a08]>{contents = "768"} = <CFNumber 0xb000000000005003 [0x100bf2a08]>{value = +1280, type = kCFNumberSInt64Type} 7 : <CFString 0x100b9b240 [0x100bf2a08]>{cont... PersonalizedDuringPreflight => <CFBoolean 0x100bf2f80 [0x100bf2a08]>{value = true} entering load_sep_os device has sep - getting firmware entering copy_restore_sep got sep firmware - making call to load it entering ramrod_load_sep_os entering ramrod_execute_command_with_input_data: /usr/libexec/seputil (0x10534c000 - 4642298) executing /usr/libexec/seputil waiting for child to exit SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: bool AppleSEPFirmware::_initFromMemory(IOMemoryDescriptor *): load ed 4642298 bytes of firmware from client SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: AppleSEP:WARNING: Could not register SEP root shmcon (err=-1) SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: AppleSEP:WARNING: Could not register SEP debugger shmcon (err=-1) SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: IOReturn AppleSEPManager::setFirmwareBytes(IOMemoryDescriptor *, b ool, bool): SEP Shared Memory Buffer at <ptr> SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: void AppleSEPBooter::_bootAction(void *, void *): SEP status: 1 SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: void AppleSEPBooter::_bootAction(void *, void *): SEP accepted Tz0 SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: void AppleSEPBooter::_bootAction(void *, void *): SEP status: 2 SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: void AppleSEPBooter::_bootAction(void *, void *): SEP status: 2 SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: IOReturn AppleSEPBooter::bootSEP(AppleSEPFirmware *, AppleSEPShare dMemoryBuffer *, bool): load the art SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: IOReturn AppleSEPBooter::bootSEP(AppleSEPFirmware *, AppleSEPShare dMemoryBuffer *, bool): separt returned is <ptr> SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: void AppleSEPBooter::_bootAction(void *, void *): SEP accepted SEP ART SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: IOReturn AppleSEPBooter::bootSEP(AppleSEPFirmware *, AppleSEPShare dMemoryBuffer *, bool): SEP booting SYSLOG: Sep 10 05:16:56 localhost kernel[0] <Notice>: IOReturn AppleSEPBooter::bootSEP(AppleSEPFirmware *, AppleSEPShare dMemoryBuffer *, bool): Shmbuf for SEP: { paddr = 0x805e60000, size = 0x10000 } SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: void AppleSEPBooter::_bootAction(void *, void *): SEP accepted IMG 4 child exited exit status: 0 entering ramrod_ticket_update looking up boot manifest hash crypto-hash-method found. Using SHA1 device tree ticket_hash: 85EA3FA2D3D80CC1A6118B0DCF38BB9FFADEA1EC computed ticket_hash : 85EA3FA2D3D80CC1A6118B0DCF38BB9FFADEA1EC received valid ticket (5468 bytes) entering partition_nand_device No IOFlashController instance found entering wait_for_storage_device Searching for NAND service Found NAND service: ASPStorage NAND initialized. Waiting for devnode. entering clear_remap_variable executing /usr/sbin/nvram Service name : ASPStorage SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: [ANS syslog: nand] Push_PowerGovernorInit:Nand Die:2 MLC: 2 N o SLC: 2 No Erase:2 SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsReadOnly - Ramdisk rooted. Returning readonly fal se SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsRootDeviceRamdisk - Root device is md0 SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsRootDeviceRamdisk - Root device is a ramdisk SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: IOFirmwareDevice::updateMediaParams - prev num blks 1024 new num b lks 1024 SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsReadOnly - Ramdisk rooted. Returning readonly fal se SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsReadOnly - Ramdisk rooted. Returning readonly fal se Set ASP writable successfully entering ramrod_reprobe_device_path entering ramrod_probe_media SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: void AppleSEPManager::_notifyOSActiveGated(): SEP/OS is alive SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: IOReturn AppleSEPARTRequests::handle_first_connected(): Configurin g in buffer SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: IOReturn AppleSEPARTRequests::handle_first_connected(): Configurin g out buffer SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: IOReturn AppleSEPARTStorage::handle_first_connected(): Sending MAN IFEST with timeout device partitioning scheme is GPT find_filesystem_partitions: storage=/dev/disk0s1 system=/dev/disk0s1s1 data=/dev/disk0s1s2 baseband data=/dev/disk0s1s3 log= entering ramrod_reprobe_device_path entering ramrod_probe_media device partitioning scheme is GPT find_filesystem_partitions: storage=/dev/disk0s1 system=/dev/disk0s1s1 data=/dev/disk0s1s2 baseband data=/dev/disk0s1s3 log= entering ramrod_probe_media device partitioning scheme is GPT find_filesystem_partitions: storage=/dev/disk0s1 system=/dev/disk0s1s1 data=/dev/disk0s1s2 baseband data=/dev/disk0s1s3 log= entering mount_partition executing /sbin/fsck_hfs SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPSEPNotifier::message - msg = 1 SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPSEPNotifier::message - kSEPNotifyOK2Wrap SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: IOReturn AppleSEPARTStorage::handle_first_connected(): Sending ART _LOAD with timeout SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsRootDeviceRamdisk - Root device is md0 SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: ASPStorage::ASPIsRootDeviceRamdisk - Root device is a ramdisk SYSLOG: Sep 10 05:16:58 localhost kernel[0] <Notice>: bool AppleSEPARTStorage::save_incoming_art(const uint8_t *, const uint8_t *): Incoming art set and synched journal_replay(/dev/disk0s1s1) returned 0 ** /dev/rdisk0s1s1 Using cacheBlockSize=32K cacheTotalBlock=3956 cacheSize=126592K. Executing fsck_hfs (version hfs-305.10.1). ** Checking Journaled HFS Plus volume. The volume name is Untitled ** Checking extents overflow file. ** Checking catalog file. ** Checking multi-linked files. ** Checking catalog hierarchy. ** Checking extended attributes file. ** Checking volume bitmap. ** Checking volume information. ** Trimming unused blocks. ** The volume Untitled appears to be OK. CheckHFS returned 0, fsmodified = 0 executing /sbin/mount_hfs mount_hfs: Invalid argument mount_hfs: error on mount(): error = -1. mounting /dev/disk0s1s1 on /mnt1 failed block size for /dev/disk0s1s1: 4096 /sbin/newfs_hfs -s -v System /dev/disk0s1s1 executing /sbin/newfs_hfs -s -v System /dev/disk0s1s1 Initialized /dev/rdisk0s1s1 as a 3 GB case-sensitive HFS Plus volume entering ramrod_probe_media device partitioning scheme is GPT find_filesystem_partitions: storage=/dev/disk0s1 system=/dev/disk0s1s1 data=/dev/disk0s1s2 baseband data=/dev/disk0s1s3 log= entering mount_partition executing /sbin/fsck_hfs journal_replay(/dev/disk0s1s1) returned 0 ** /dev/rdisk0s1s1 Using cacheBlockSize=32K cacheTotalBlock=3956 cacheSize=126592K. Executing fsck_hfs (version hfs-305.10.1). ** Checking non-journaled HFS Plus Volume. ** Detected a case-sensitive volume. The volume name is System ** Checking extents overflow file. ** Checking catalog file. ** Checking multi-linked files. ** Checking catalog hierarchy. ** Checking extended attributes file. ** Checking volume bitmap. ** Checking volume information. ** Trimming unused blocks. ** The volume System appears to be OK. CheckHFS returned 0, fsmodified = 0 executing /sbin/mount_hfs /dev/disk0s1s1 mounted on /mnt1 System mounted read-only unable to open /mnt1/System/Library/CoreServices/SystemVersion.plist: No such file or directory ramrod_read_previous_os_build_version: Unable to read system version plist restored_fdr_initialize: FDR is supported CryptoAcceleratorEncrypt: perform aes => 0 (kIOReturnSuccess) pseudo_ccrng_allocate: ccdrbg_init() -> 0 CryptoGenerateRSAKeys: ccrsa_generate_key() -> 0 CryptoGenerateRSAKeys: [RSA Public Key SHA1: 20 bytes] : 85 13 37 f3 e4 a7 d9 10 6b 7e f4 7e 28 f3 ed 66 : 78 6b 26 69 : ----------------------------------------------- CryptoGenerateRSAKeys: SecKeyCreateRSAPrivateKey -> 0x10014c460 CryptoGenerateRSAKeys: SecKeyCreateRSAPublicKey -> 0x10014c458 SYSLOG: Sep 10 05:17:00 localhost restored_external[6] <Error>: libMobileGestalt utility.c:260: IOServiceGetMatchingServ ice failed SYSLOG: Sep 10 05:17:00 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:3433: failed to connect to service AppleBiometricServices _copyDataInstanceForSealingMapEntry: Could not query MobileGestalt for key 'MesaSerialNumber' AMFDRSealingMapCreateRecoveryPermissions: Failed to construct data instance for sealing map entry: <CFBasicHash 0x155612 7f0 [0x100bf2a08]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x155612700 [0x100bf2a08]>{contents = "Attributes"} = <CFArray 0x1556127b0 [0x100bf2a08]>{type = i mmutable, count = 2, values = ( 0 : <CFString 0x155612770 [0x100bf2a08]>{contents = "RequiredToSeal"} 1 : <CFString 0x155612790 [0x100bf2a08]>{contents = "StoreCombined"} )} 1 : <CFString 0x155612690 [0x100bf2a08]>{contents = "Tag"} = <CFString 0x155612720 [0x100bf2a08]>{contents = "FS Cl"} 5 : <CFString 0x1556126b0 [0x100bf2a08]>{contents = "MaxSize"} = <CFNumber 0xb000000000c00003 [0x100bf2a08]>{val ue = +786432, type = kCFNumberSInt64Type} 6 : <CFString 0x1556126d0 [0x100bf2a08]>{contents = "DataInstanceIdentifier"} = <CFString 0x155612740 [0x100bf2a 08]>{contents = "MesaSerialNumber"} } Continuing anyway. SYSLOG: Sep 10 05:17:00 localhost restored_external[6] <Error>: libMobileGestalt utility.c:260: IOServiceGetMatchingServ ice failed SYSLOG: Sep 10 05:17:00 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:3433: failed to connect to service AppleBiometricServices _copyDataInstanceForSealingMapEntry: Could not query MobileGestalt for key 'MesaSerialNumber' AMFDRSealingMapCreateRecoveryPermissions: Failed to construct data instance for sealing map entry: <CFBasicHash 0x155612 a10 [0x100bf2a08]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x155612920 [0x100bf2a08]>{contents = "Attributes"} = <CFArray 0x1556129d0 [0x100bf2a08]>{type = i mmutable, count = 2, values = ( 0 : <CFString 0x155612990 [0x100bf2a08]>{contents = "RequiredToSeal"} 1 : <CFString 0x1556129b0 [0x100bf2a08]>{contents = "StoreCombined"} )} 1 : <CFString 0x1556128b0 [0x100bf2a08]>{contents = "Tag"} = <CFString 0x155612940 [0x100bf2a08]>{contents = "ho p0"} 5 : <CFString 0x1556128d0 [0x100bf2a08]>{contents = "MaxSize"} = <CFNumber 0xb000000000010003 [0x100bf2a08]>{val ue = +4096, type = kCFNumberSInt64Type} 6 : <CFString 0x1556128f0 [0x100bf2a08]>{contents = "DataInstanceIdentifier"} = <CFString 0x155612960 [0x100bf2a 08]>{contents = "MesaSerialNumber"} } Continuing anyway. SYSLOG: Sep 10 05:17:00 localhost restored_external[6] <Error>: libMobileGestalt utility.c:260: IOServiceGetMatchingServ ice failed SYSLOG: Sep 10 05:17:00 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:3433: failed to connect to service AppleBiometricServices _copyDataInstanceForSealingMapEntry: Could not query MobileGestalt for key 'MesaSerialNumber' AMFDRSealingMapCreateRecoveryPermissions: Failed to construct data instance for sealing map entry: <CFBasicHash 0x155612 c30 [0x100bf2a08]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x155612b40 [0x100bf2a08]>{contents = "Attributes"} = <CFArray 0x155612bf0 [0x100bf2a08]>{type = i mmutable, count = 2, values = ( 0 : <CFString 0x155612bb0 [0x100bf2a08]>{contents = "RequiredToSeal"} 1 : <CFString 0x155612bd0 [0x100bf2a08]>{contents = "StoreCombined"} )} 1 : <CFString 0x155612ad0 [0x100bf2a08]>{contents = "Tag"} = <CFString 0x155612b60 [0x100bf2a08]>{contents = "Nv MR"} 5 : <CFString 0x155612af0 [0x100bf2a08]>{contents = "MaxSize"} = <CFNumber 0xb000000000c00003 [0x100bf2a08]>{val ue = +786432, type = kCFNumberSInt64Type} 6 : <CFString 0x155612b10 [0x100bf2a08]>{contents = "DataInstanceIdentifier"} = <CFString 0x155612b80 [0x100bf2a 08]>{contents = "MesaSerialNumber"} } Continuing anyway. created HTTP FDR client 0x155618260 SYSLOG: Sep 10 05:17:01 localhost restored_external[6] <Error>: libMobileGestalt utility.c:260: IOServiceGetMatchingServ ice failed SYSLOG: Sep 10 05:17:01 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:3433: failed to connect to service AppleBiometricServices _copyDataInstanceForSealingMapEntry: Could not query MobileGestalt for key 'MesaSerialNumber' AMFDRSealingMapCreateRecoveryPermissions: Failed to construct data instance for sealing map entry: <CFBasicHash 0x155612 7f0 [0x100bf2a08]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x155612700 [0x100bf2a08]>{contents = "Attributes"} = <CFArray 0x1556127b0 [0x100bf2a08]>{type = i mmutable, count = 2, values = ( 0 : <CFString 0x155612770 [0x100bf2a08]>{contents = "RequiredToSeal"} 1 : <CFString 0x155612790 [0x100bf2a08]>{contents = "StoreCombined"} )} 1 : <CFString 0x155612690 [0x100bf2a08]>{contents = "Tag"} = <CFString 0x155612720 [0x100bf2a08]>{contents = "FS Cl"} 5 : <CFString 0x1556126b0 [0x100bf2a08]>{contents = "MaxSize"} = <CFNumber 0xb000000000c00003 [0x100bf2a08]>{val ue = +786432, type = kCFNumberSInt64Type} 6 : <CFString 0x1556126d0 [0x100bf2a08]>{contents = "DataInstanceIdentifier"} = <CFString 0x155612740 [0x100bf2a 08]>{contents = "MesaSerialNumber"} } Continuing anyway. SYSLOG: Sep 10 05:17:01 localhost restored_external[6] <Error>: libMobileGestalt utility.c:260: IOServiceGetMatchingServ ice failed SYSLOG: Sep 10 05:17:01 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:3433: failed to connect to service AppleBiometricServices _copyDataInstanceForSealingMapEntry: Could not query MobileGestalt for key 'MesaSerialNumber' AMFDRSealingMapCreateRecoveryPermissions: Failed to construct data instance for sealing map entry: <CFBasicHash 0x155612 a10 [0x100bf2a08]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x155612920 [0x100bf2a08]>{contents = "Attributes"} = <CFArray 0x1556129d0 [0x100bf2a08]>{type = i mmutable, count = 2, values = ( 0 : <CFString 0x155612990 [0x100bf2a08]>{contents = "RequiredToSeal"} 1 : <CFString 0x1556129b0 [0x100bf2a08]>{contents = "StoreCombined"} )} 1 : <CFString 0x1556128b0 [0x100bf2a08]>{contents = "Tag"} = <CFString 0x155612940 [0x100bf2a08]>{contents = "ho p0"} 5 : <CFString 0x1556128d0 [0x100bf2a08]>{contents = "MaxSize"} = <CFNumber 0xb000000000010003 [0x100bf2a08]>{val ue = +4096, type = kCFNumberSInt64Type} 6 : <CFString 0x1556128f0 [0x100bf2a08]>{contents = "DataInstanceIdentifier"} = <CFString 0x155612960 [0x100bf2a 08]>{contents = "MesaSerialNumber"} } Continuing anyway. SYSLOG: Sep 10 05:17:01 localhost restored_external[6] <Error>: libMobileGestalt utility.c:260: IOServiceGetMatchingServ ice failed SYSLOG: Sep 10 05:17:01 localhost restored_external[6] <Error>: libMobileGestalt MobileGestalt.c:3433: failed to connect to service AppleBiometricServices _copyDataInstanceForSealingMapEntry: Could not query MobileGestalt for key 'MesaSerialNumber' AMFDRSealingMapCreateRecoveryPermissions: Failed to construct data instance for sealing map entry: <CFBasicHash 0x155612 c30 [0x100bf2a08]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x155612b40 [0x100bf2a08]>{contents = "Attributes"} = <CFArray 0x155612bf0 [0x100bf2a08]>{type = i mmutable, count = 2, values = ( 0 : <CFString 0x155612bb0 [0x100bf2a08]>{contents = "RequiredToSeal"} 1 : <CFString 0x155612bd0 [0x100bf2a08]>{contents = "StoreCombined"} )} 1 : <CFString 0x155612ad0 [0x100bf2a08]>{contents = "Tag"} = <CFString 0x155612b60 [0x100bf2a08]>{contents = "Nv MR"} 5 : <CFString 0x155612af0 [0x100bf2a08]>{contents = "MaxSize"} = <CFNumber 0xb000000000c00003 [0x100bf2a08]>{val ue = +786432, type = kCFNumberSInt64Type} 6 : <CFString 0x155612b10 [0x100bf2a08]>{contents = "DataInstanceIdentifier"} = <CFString 0x155612b80 [0x100bf2a 08]>{contents = "MesaSerialNumber"} } Continuing anyway. created local FDR client 0x155619520 Received response without expected RESTORED_FDR_TRUST_DATA AMSupportPlatformMakeDirectoryForURL: Could not mkdir (Read-only file system) AMFDRCreateError: AMFDRDataLocalCopyDataStoragePath: AMSupportMakeDirectory failed: code=4 AMFDRCreateError: AMFDRDataLocalCopy: missing data storage path: code=4 failed to copy trust object from fdrLocal 0: AMFDRError/4: missing data storage path 1: AMFDRError/4: AMSupportMakeDirectory failed _AMFDRHttpRequestSendSyncNoRetry: No cookie found _AMFDRHttpCopyProxyInformation: Failed to get proxy info for URL 'http://gg.apple.com/fdrtrustobject/5340B6A059BDB732E71 5E7BB1B292EDCD45C2A8D1D07E6039D3F338D7C4428AB' _AMFDRHttpMessageSendSync: Failed to copy proxy information and proxy is enabled. AMFDRCreateError: _AMFDRHttpRequestSendSyncNoRetry: _AMFDRHttpMessageSendSync failed: code=8 AMFDRCreateError: _AMFDRHttpRequestSendSync: httpResponseHeader is NULL: code=10 AMFDRCreateError: AMFDRDataHTTPCopyTrustObject: AMFDRDataHTTPCopyTrustObject failed: code=8 failed to copy trust object from fdrHttp 0: AMFDRError/8: AMFDRDataHTTPCopyTrustObject failed 1: AMFDRError/a: httpResponseHeader is NULL 2: AMFDRError/8: _AMFDRHttpMessageSendSync failed 3: AMFDRError/4: missing data storage path 4: AMFDRError/4: AMSupportMakeDirectory failed RestoredFDRCreate() returned 6 FDR is not supported on this device ERROR: Unable to successfully restore device No data to read ERROR: Unable to restore device
memeismygod / Hackimport asyncio import discord import json import re import random import json import inspect from paginator import Paginator from math import ceil import subprocess import aiohttp import hashlib class PokeBall(discord.Client): def __init__(self, config_path: str, guild_path: str, pokelist_path: str, pokenames_path: str, *args, **kwargs): self.version = "v3.3.2" self.config_path = config_path self.guild_path = guild_path self.pokelist_path = pokelist_path with open(self.guild_path) as f: self.prefix_dict = json.load(f) with open(self.config_path) as f: self.configs = json.load(f) self.prefix = self.configs['command_prefix'] super().__init__() with open(self.pokelist_path, 'r', encoding='utf-8') as f: self.pokelist = f.read().splitlines() self.legendaries = [ 'Arceus', 'Articuno', 'Azelf', 'Celebi', 'Cobalion', 'Cosmoem', 'Cosmog', 'Cresselia', 'Darkrai', 'Deoxys', 'Dialga', 'Diancie', 'Entei', 'Genesect', 'Giratina', 'Groudon', 'Heatran', 'Ho-Oh', 'Hoopa', 'Jirachi', 'Keldeo', 'Kyogre', 'Kyurem', 'Landorus', 'Latias', 'Latios', 'Lugia', 'Lunala', 'Magearna', 'Manaphy', 'Marshadow', 'Meloetta', 'Mesprit', 'Mew', 'Mewtwo', 'Moltres', 'Necrozma', 'Palkia', 'Phione', 'Raikou', 'Rayquaza', 'Regice', 'Regigigas', 'Regirock', 'Registeel', 'Reshiram', 'Shaymin', 'Silvally', 'Solgaleo', 'Suicune', 'Tapu Bulu', 'Tapu Fini', 'Tapu Koko', 'Tapu Lele', 'Terrakion', 'Thundurus', 'Tornadus', 'Type: Null', 'Uxie', 'Victini', 'Virizion', 'Volcanion', 'Xerneas', 'Yveltal', 'Zapdos', 'Zekrom', 'Zeraora', 'Zygarde' ] pokemons = [pokemon.split(' -> ')[0] for pokemon in self.pokelist] self.trash = list({dup for dup in pokemons if pokemons.count(dup) > int(self.configs["max_duplicates"]) - 1}) self.priority_only = self.configs["priority_only"] self.auto_catcher = self.configs["autocatcher"] self.mode = "blacklist" self.guild_mode = "blacklist" self.autolog = self.configs["autolog"] self.ready = False with open(pokenames_path, 'r', encoding='utf-8') as f: self.pokenames = json.load(f) def run(self): super().run(self.configs['token'], bot=False) def refresh_trash(self): pokemons = [pokemon.split(' -> ')[0] for pokemon in self.pokelist] self.trash = list({dup for dup in pokemons if pokemons.count(dup) > int(self.configs["max_duplicates"]) - 1}) def junky_trash(self): def safe_filter(pokemon): names = [pokemon.split(' -> ')[0] for pokemon in self.pokelist] checks = [ pokemon.split(' -> ')[1]!='1', pokemon.split(' -> ')[0] not in ( self.configs['priority'] + self.legendaries ), names.count(pokemon.split(' -> ')[0]) > int(self.configs["max_duplicates"]), len(pokemon.split(' -> ')) <= 3 ] return all(checks) def guard(pokes): limit = int(self.configs['max_duplicates']) pokelist = pokes[:] for poke in pokelist: pokename = poke[0] mons = [mon[0] for mon in pokelist] while mons.count(pokename) > limit: pokelist.pop(mons.index(pokename)) mons = [mon[0] for mon in pokelist] return pokelist results = [pokemon.split(' -> ') for pokemon in self.pokelist if safe_filter(pokemon)] junk = sorted(results, key=(lambda x: (x[0], int(x[2])))) safe = guard(junk) pokes = [poke for poke in junk if poke not in safe] return pokes def is_legend(self, pokemon): return pokemon in self.legendaries def get_id(self, pokename, search=False): def assert_name(pokemon): return pokemon.split(' -> ')[0].lower() == pokename.lower() def search_name(pokemon): return pokename.lower() in pokemon.split(' -> ')[0].lower() results = [] if search: results = [ pokemon.split(' -> ') for pokemon in self.pokelist if search_name(pokemon) ] else: results = [ pokemon.split(' -> ')[1] for pokemon in self.pokelist if assert_name(pokemon) ] return results or "\u200B" def new_guild(self, message, pref): if message.guild.id not in self.prefix_dict.keys(): self.prefix_dict[message.guild.id] = pref.split('catch')[0] with open(self.guild_path, 'w') as f: f.write(json.dumps(self.prefix_dict)) async def match(self, url): async with await self.sess.get(url) as resp: dat = await resp.content.read() m = hashlib.md5(dat).hexdigest() return self.pokenames[m] async def on_message(self, message): def pokecord_reply(msg): return msg.author.id == 365975655608745985 if not self.ready: return if "guild" not in dir(message): #Skip DMs to avoid AttributeError (alt) return if message.guild is None: #Skip DMs to avoid AttributeError return else: blacklist_checks = [ self.mode == "blacklist", message.channel.id in self.configs["blacklists"] ] whitelist_checks = [ self.mode == "whitelist", message.channel.id not in self.configs["whitelists"] ] blackguild_checks = [ self.guild_mode == "blacklist", message.guild.id in self.configs["blacklist_guilds"] ] whiteguild_checks = [ self.guild_mode == "whitelist", message.guild.id not in self.configs["whitelist_guilds"] ] return_checks = [ all(blacklist_checks), all(whitelist_checks), all(blackguild_checks), all(whiteguild_checks) ] if any(return_checks): return #AutoCatcher pokeball_checks = [ message.author.id == 365975655608745985, message.embeds, self.auto_catcher ] if all(pokeball_checks): def log_formatter(pokemon): params = pokemon.split(' | ') name = params[0].replace('**', '') level = params[1].replace('Level: ', '') number = params[2].replace('Number: ', '') return f"{name} -> {number} -> {level}" emb = message.embeds[0] try: embcheck = emb.title.startswith('A wild') except AttributeError: return if embcheck: name = await self.match(emb.image.url.split('?')[0]) name = name.title() if not name: print(f"Unable to find a name for {name1}.") return duplicate_checks = [ name in self.trash, name not in ( self.configs['priority'] + self.legendaries ), self.configs["restrict_duplicates"] ] proc = random.randint(1, 100) sub_checks = [ name in self.configs['priority'], name in self.legendaries ] def catch_checks(name): if self.priority_only: return any(sub_checks) elif not any(sub_checks): catch_subchecks = [ proc <= self.configs['catch_rate'], name not in self.configs['avoid'] ] return all(catch_subchecks) else: return True catcher = catch_checks(name) if catcher: async with message.channel.typing(): pref = emb.description.split()[5] self.new_guild(message, pref) delay_checks = [ self.configs['delay_on_priority'], name in ( self.configs["priority"] + self.legendaries ) ] if all(delay_checks) or not any(sub_checks): await asyncio.sleep(self.configs['delay']) if all(duplicate_checks): print(f"Skipping the duplicate: {name}") return await message.channel.send(f"{pref} {name}") reply = await self.wait_for('message', check=pokecord_reply) if self.user.mentioned_in(reply): print(f'Caught **{name}** in *{message.guild.name}* in #{message.channel.name}') if self.autolog: await message.channel.send(f"{pref.replace('catch','pokemon')} --name {name}") reply = await self.wait_for('message', check=pokecord_reply) if reply.embeds and reply.channel.id == message.channel.id: raw_list = reply.embeds[0].description.splitlines() refined_list = [ log_formatter(pokeline) for pokeline in raw_list if log_formatter(pokeline) not in self.pokelist ] self.pokelist.append(refined_list[0]) with open(self.pokelist_path, 'w', encoding='utf-8') as f: f.write('\n'.join(self.pokelist)) #SelfBot Commands prefix_checks = [ message.content.startswith(self.prefix), message.author.id == self.user.id ] if all(prefix_checks): def arg_check(arg): str_mentions = [str(mention) for mention in raw_mentions] if not raw_mentions: return True checks = [ raw_mentions, arg != '', arg.replace('<@','').replace('>','') not in str_mentions ] return all(checks) raw_mentions = message.raw_mentions or None detokenized = message.content.split(' ') cmd = detokenized[0] args = [] if len(detokenized) > 1: if raw_mentions: args = [ arg for arg in detokenized[1:] if arg_check(arg) ] else: args = [arg for arg in detokenized[1:] if arg != ''] cmd = cmd.replace(self.prefix,'cmd_').lower() try: method = self.__getattribute__(cmd) except AttributeError: # Not a selfbot command, so execute it as a PokeCord command. cmd = cmd.replace('cmd_', '') args.insert(0, cmd) method = self.cmd_poke_exec kwargs = { 'message':message, 'args': args, 'mentions': [] } if message.mentions: kwargs['mentions'] = message.mentions required = inspect.signature(method) required = set(required.parameters.copy()) for key in list(kwargs): if key not in required: kwargs.pop(key, None) if required == set(kwargs): await method(**kwargs) async def cmd_pokelog(self, message, args=[]): def pokecord_reply(msg): if msg.embeds: checks = [ msg.author.id == 365975655608745985, msg.channel.id == message.channel.id, msg.embeds[0].title.startswith('Your pokémon:') ] return all(checks) else: return False def pokecord_edit(before, msg): if msg.embeds: checks = [ msg.author.id == 365975655608745985, msg.channel.id == message.channel.id, msg.embeds[0].title.startswith('Your pokémon:') ] return all(checks) else: return False def log_formatter(pokemon): params = pokemon.split(' | ') name = params[0].replace('**', '') level = params[1].replace('Level: ', '') number = params[2].replace('Number: ', '') if len(params) == 4: nick = params[3].replace('Nickname: ','') return f"{name} -> {number} -> {level} -> {nick}" return f"{name} -> {number} -> {level}" pref = self.prefix_dict.get(str(message.guild.id), None) if pref: page = 1 pokelist = [] if args: page = int(args[0]) if len(args) > 1 and args[1] == 'continue': with open(self.pokelist_path, 'r', encoding='utf-8') as f: pokelist = f.read().splitlines() await message.channel.send(f"{pref}pokemon {args[0]}") else: await message.channel.send(f"{pref}pokemon") reply = await self.wait_for('message', check=pokecord_reply) pokemons = reply.embeds[0].description.split('\n') pokelist += [log_formatter(pokemon) for pokemon in pokemons] await asyncio.sleep(random.randint(2,3)) while True: delme = await message.channel.send(f"{pref}n") try: before, reply = await self.wait_for('message_edit', check=pokecord_edit, timeout=10.0) except: await message.channel.send(f"{pref}pokemon {page + 1}") try: reply = await self.wait_for('message', check=pokecord_reply, timeout=10.0) except: await message.channel.send(f"Logged up to page {page}.") pokemons = reply.embeds[0].description.split('\n') try: await delme.delete() except: pass page += 1 pokelist += [log_formatter(pokemon) for pokemon in pokemons] with open(self.pokelist_path, 'w', encoding='utf-8') as f: f.write('\n'.join(pokelist)) self.pokelist = pokelist if len(pokemons) < 20: break else: await asyncio.sleep(random.randint(5,7)) self.pokelist = pokelist self.refresh_trash() print('Logged all the pokemon successfully.\n') await self.cmd_total(message=message) else: print('No prefix found for this guild.') async def cmd_trade(self, message, mentions, args=[]): def safe_filter(pokemon): checks = [ pokemon.split(' -> ')[1]!='1', pokemon.split(' -> ')[0] not in self.configs['priority'] ] return all(checks) def user_reply(msg): checks = [ msg.author.id == user.id, word in msg.content ] return all(checks) def pokecord_reply(msg): return msg.author.id == 365975655608745985 and msg.channel.id == message.channel.id def pokecord_embed(msg): checks = [ msg.author.id == 365975655608745985, msg.channel.id == message.channel.id, msg.embeds ] return all(checks) def id_extracter(pokemon): params = pokemon.split(' | ') name = params[0].replace('**', '') level = params[1].replace('Level: ', '') number = params[2].replace('Number: ', '') return int(number) user = mentions[0] pref = self.prefix_dict.get(str(message.guild.id), None) if pref: with open(self.pokelist_path,'r', encoding='utf-8') as f: pokelist = f.read().splitlines() if args: if "fav" in args: await message.channel.send(f"{pref}fav") try: reply = await self.wait_for('message', check=pokecord_reply, timeout=2.0) except: await message.channel.send(f"{pref}ping") await message.channel.send(f"{pref}fav") reply = await self.wait_for('message', check=pokecord_reply) if reply.embeds and reply.embeds[0].title == "Your pokémon:": pokemons = reply.embeds[0].description.split('\n') numbers = [id_extracter(pokeline) for pokeline in pokemons] else: numlist = [] for arg in args: if all(char.isalpha() for char in arg): numlist += self.get_id(args[0].title()) else: numlist.append(arg) numbers = numlist else: numbers = [pokemon.split(' -> ')[1] for pokemon in self.pokelist if safe_filter(pokemon)] numbers = sorted(numbers,reverse=True) numbatches = [numbers[i:i+25] for i in range(0, len(numbers), 25)] for numbers in numbatches: await message.channel.send(f"{pref}trade {user.mention}") word = f"{pref}accept" reply = await self.wait_for('message', check=user_reply) confirmation = await self.wait_for('message', check=pokecord_embed) for number in numbers: await message.channel.send(f"{pref}p add {number}") await asyncio.sleep(2.0) await message.channel.send(f"{pref}confirm") confirmation = await self.wait_for('message', check=pokecord_reply) if confirmation.content == "Trade confirmed.": await asyncio.sleep(3.0) else: continue print('Successfully traded away all pokemon.') await self.cmd_pokelog(message) async def cmd_poke_exec(self, message, args=[], mentions=None): pref = self.prefix_dict.get(str(message.guild.id), None) if pref and args: command = args.pop(0) pokeargs = ' '.join(args) pokementions = ' '+' '.join([mention.mention for mention in mentions]) or '' pokecmd = f"{pref}{command}{pokementions}{pokeargs}" await message.channel.send(pokecmd) async def cmd_echo(self, message, args=[], mentions=None): if args: await message.channel.send(f"{' '.join(args)} {' '.join([mention.mention for mention in mentions])}") async def cmd_id(self, message, args=[]): pref = self.prefix_dict.get(str(message.guild.id), None) if pref and args: if len(args) > 1 and args[0] == 'search': pokename = args[1] results = self.get_id(pokename, True) embeds = [] for i in range(0, len(results), 10): embed = discord.Embed(title="Search Results", description="\u200B", color=15728640) if results == "\u200B": continue else: for result in results[i:i+10]: embed.add_field(name=result[0], value=f"**ID**: {result[1]}\n**LEVEL**: {result[2]}", inline=False) embeds.append(embed) try: base = await message.channel.send(content=None, embed=embeds[0]) pager = Paginator(message, base, embeds, self) await pager.run() except: await message.channel.send(":cold_sweat: | No results found.") else: pokename = args[0] results = self.get_id(pokename, True) embed = discord.Embed(title=pokename.title(), description="\u200B", color=15728640) if results == "\u200B": await message.channel.send(":cold_sweat: | No results found.") return else: for result in results: embed.add_field(name="**ID**", value=f"{result[1]}", inline=False) embed.add_field(name="**LEVEL**", value=f"{result[2]}", inline=False) embed.add_field(name="-----", value="\u200B", inline=False) await message.channel.send(content=None, embed=embed) async def cmd_duplicates(self, message, args=[]): pokemons = [pokemon.split(' -> ')[0] for pokemon in self.pokelist] limit = 2 if args: limit = int(args[0]) dups = {dup for dup in pokemons if pokemons.count(dup) >= limit} if len(dups) == 0: await message.channel.send("There is no pokemon with so many duplicates. Try a smaller number.") return dups = list(dups) dups = sorted(dups) embeds = [] for i in range(0, len(dups), 10): embed = discord.Embed(title="Duplicates", description="\u200B", color=15728640) for dup in dups[i:i+10]: results = self.get_id(dup, True) data = [f"**ID**: {result[1]}\t**LEVEL**: {result[2]}" for result in results] data.append('-------------------------------------------------') embed.add_field(name=f"**{dup}**", value='\n'.join(data), inline=False) embed.set_footer(text=f"{(i//10)+1}/{ceil(len(dups)/10)}") embeds.append(embed) base = await message.channel.send(content=None, embed=embeds[0]) pager = Paginator(message, base, embeds, self) await pager.run() async def cmd_legendary(self, message): embeds = [] for i in range(0, len(self.legendaries), 5): embed = discord.Embed(title="Legendaries", description="\u200B", color=15728640) for legend in self.legendaries[i:i+5]: embed.add_field(name=legend, value='\n'.join(self.get_id(legend)), inline=False) embeds.append(embed) base = await message.channel.send(content=None, embed=embeds[0]) pager = Paginator(message, base, embeds, self) await pager.run() async def cmd_total(self, message): await message.channel.send(f"Total number of pokemon:\n{len(self.pokelist)}") async def cmd_mass_release(self, message, args=[]): def pokecord_reply(msg): return msg.author.id == 365975655608745985 and msg.channel.id == message.channel.id def pokecord_embed(msg): checks = [ msg.author.id == 365975655608745985, msg.channel.id == message.channel.id, msg.embeds ] return all(checks) pref = self.prefix_dict.get(str(message.guild.id), None) if pref and args: if "dupes" in (arg.lower() for arg in args): junk = self.junky_trash() numbers = [mon[1] for mon in junk] else: numbers = args numlist = list(set(sorted(numbers, key=lambda x: int(x), reverse=True))) for numbers in numlist: num_str = ' '.join(numbers) await message.channel.send(f"{pref}release {num_str}") desc = await self.wait_for('message', check=pokecord_embed) desc = desc.embeds[0] criticals = ( self.configs["priority"] + self.legendaries ) desc = desc.to_dict()["fields"][0]["value"] for pokemon in criticals: if pokemon in desc: print(f"WOAH! Almost deleted {pokemon}!") return await asyncio.sleep(1.0) await message.channel.send(f"{pref}confirm") await self.wait_for('message', check=pokecord_reply) await self.cmd_pokelog(message) print("Successfully Released all the specified pokemons.") async def cmd_priority_only(self, message, args=[]): if args: if args[0].lower() == 'off': self.priority_only = False print('Catching all pokemons.\n') elif args[0].lower() == 'on': self.priority_only = True print('Catching only priority and legendary pokemon.\n') else: print(args) async def cmd_autocatcher(self, message, args=[]): if args: if args[0].lower() == 'off': self.auto_catcher = False print('Switching to Commands Only mode.\n') elif args[0].lower() == 'on': self.auto_catcher = True print('Activated autocatcher.\n') else: print(args) async def cmd_autolog(self, message, args=[]): if args: if args[0].lower() == 'off': self.autolog = False print('Disabled Autologger.\n') elif args[0].lower() == 'on': self.autolog = True print('Enabled Autologger.\n') else: print(args) async def cmd_toggle_mode(self, message, args=[]): if args and args[0].lower() in ["blacklist", "whitelist"]: self.mode = args[0].lower() print(f"Switched to {args[0].title()} mode.") async def cmd_toggle_guildmode(self, message, args=[]): if args and args[0].lower() in ["blacklist", "whitelist"]: self.guild_mode = args[0].lower() print(f"Switched to {args[0].title()}ed guilds mode.") async def cmd_gift(self, message, mentions, args=[]): def user_reply(msg): checks = [ msg.author.id == user.id, word in msg.content ] return all(checks) def pokecord_reply(msg): return msg.author.id == 365975655608745985 and msg.channel.id == message.channel.id def pokecord_embed(msg): checks = [ msg.author.id == 365975655608745985, msg.channel.id == message.channel.id, msg.embeds ] return all(checks) user = mentions[0] pref = self.prefix_dict.get(str(message.guild.id), None) if pref and args: money = args[0] await message.channel.send(f"{pref}trade {user.mention}") word = f"{pref}accept" reply = await self.wait_for('message', check=user_reply) confirmation = await self.wait_for('message', check=pokecord_embed) await message.channel.send(f"{pref}c add {money}") await asyncio.sleep(2.0) await message.channel.send(f"{pref}confirm") confirmation = await self.wait_for('message', check=pokecord_reply) if confirmation.content == "Trade confirmed.": print(f'Successfully gifted {money}c to {user}.') async def on_ready(self): async def updater(): def bordered(text): # Kudos to xKynn for this. lines = text.splitlines() width = max(len(s) for s in lines) + 2 res = ['┌' + '─' * width + '┐'] for s in lines: res.append('│ ' + (s + ' ' * width)[:width - 1] + '│') res.append('└' + '─' * width + '┘') return '\n'.join(res) async def file_modifier(filename): async with aiohttp.ClientSession(headers=api_headers, loop=self.loop) as sess: async with sess.get(f"{api_base_url}/{filename}") as resp: if ".json" in filename: code = await resp.read() code = code.decode() else: code = await resp.text() with open(filename, 'w', encoding='utf-8') as f: f.write(code) def config_patcher(base_configs): with open('config.json', 'r', encoding='utf-8') as f: configs = json.load(f) if list(configs.keys()) != list(base_configs.keys()): keys = [key for key in list(base_configs.keys()) if key not in list(configs.keys())] for key in keys: configs[key] = base_configs[key] with open('config.json', 'w', encoding='utf-8') as f: f.write(json.dumps(configs, indent=3)) api_base_url = "https://api.github.com/repos/Hyperclaw79/PokeBall-SelfBot/contents" if self.configs["update_checker"]: # For those with error connecting to api.github.com api_headers = { "Accept": "application/vnd.github.v3.raw+json", "User-Agent": f"Pokeball-Selfbot_{self.user}" } async with aiohttp.ClientSession(headers=api_headers, loop=self.loop) as sess: async with sess.get(f"{api_base_url}/_version.json") as resp: ver_data = await resp.read() ver_data = json.loads(ver_data) vnum = int(ver_data["version"].split('v')[1].replace('.', '')) lnum = int(self.version.split('v')[1].replace('.', '')) if vnum > lnum: vtext = 'There is a new version available.\nDownload it for new updates and bug fixes.\n' vtext += f'Your version: {self.version}\nNew Version: {ver_data["version"]}\n' print(bordered(vtext)) if self.configs["auto_update"]: print("Automatic updates are enabled.") await asyncio.sleep(2.0) print(f'Automatically updating to {ver_data["version"]}....') mod_files = [filename for filename in ver_data["modified_files"] if filename not in __file__ and filename != 'config.json'] for _file in mod_files: await file_modifier(_file) await asyncio.sleep(1.0) if "config.json" in ver_data["modified_files"]: async with aiohttp.ClientSession(headers=api_headers, loop=self.loop) as sess: async with sess.get(f"{api_base_url}/config.json") as resp: configs_data = await resp.read() base_configs = json.loads(configs_data) config_patcher(base_configs) await asyncio.sleep(1.0) if "pokeball.py" in ver_data["modified_files"]: await file_modifier("pokeball.py") subprocess.run("run.bat") # Change this to run.sh if you're on a mac/linux self.sess = aiohttp.ClientSession(loop=self.loop) await updater() priorities = self.configs['priority'] prio_list = '\n'.join([ ', '.join(priorities[i:i+5]) for i in range(0, len(priorities), 5) ]) try: blackies = '\n'.join([ ', '.join([str(channel) for channel in self.configs['blacklists'][i:i+5]]) for i in range(0, len(self.configs['blacklists']), 5) ]) except: blackies = "None" try: whities = '\n'.join([ ', '.join([str(channel) for channel in self.configs['whitelists'][i:i+5]]) for i in range(0, len(self.configs['whitelists']), 5) ]) except: whities = "None" try: blackgs = '\n\t'.join([ ', '.join([str(channel) for channel in self.configs['blacklist_guilds'][i:i+5]]) for i in range(0, len(self.configs['blacklist_guilds']), 5) ]) except: blackgs = "None" try: whitigs = '\n\t'.join([ ', '.join([str(channel) for channel in self.configs['whitelist_guilds'][i:i+5]]) for i in range(0, len(self.configs['whitelist_guilds']), 5) ]) except: whitigs = "None" print( f"\n---PokeBall SelfBot {self.version}----\n\n" f"Bot name: {self.user}\n\n" f"Command Prefix: {self.configs['command_prefix']}\n\n" f"Priority:\n~~~~~~~~~\n{prio_list}\n\n" f"Catch Rate: {self.configs['catch_rate']}%\n\n" f"Catch Delay: {self.configs['delay']} seconds\n\n" f"Delay On Priority: {'On' if self.configs['delay_on_priority'] == True else 'Off'}\n\n" f"Restrict Catching of Duplicates: {'On' if self.configs['delay_on_priority'] == True else 'Off'}\n\n" f"Maximum Number of Duplicates: {self.configs['max_duplicates']}\n\n" f"Blacklisted Channels:\n~~~~~~~~~~~~~~~~~~~~\n{blackies}\n\n" f"Whitelisted Channels:\n~~~~~~~~~~~~~~~~~~~~\n{whities}\n\n" f"Blacklisted Guilds:\n~~~~~~~~~~~~~~~~~~~~\n{blackgs}\n\n" f"Whitelisted Guilds:\n~~~~~~~~~~~~~~~~~~~~\n{whitigs}\n\n" f"Autocatcher: {'On' if self.configs['autocatcher'] == True else 'Off'}\n\n" f"Priority Only: {'On' if self.configs['priority_only'] == True else 'Off'}\n\n" ) self.ready = True