meta-introspector / meta-meme

The meta meme
MIT License
11 stars 1 forks source link

I would like to write github graphql query to get a discussion thread #54

Open jmikedupont2 opened 1 year ago

jmikedupont2 commented 1 year ago

I would like to write github graphql query to get a discussion thread https://github.com/meta-introspector/meta-meme/discussions/21

jmikedupont2 commented 1 year ago

To write a GitHub GraphQL query to get a discussion thread, you need to use the repository and discussion fields. The repository field takes the owner and name of the repository as arguments, and the discussion field takes the number of the discussion as an argument. You can then specify which fields of the discussion you want to retrieve, such as title, body, comments, etc. For example, this query will get the title, body, and first 10 comments of the discussion thread you mentioned:

query {
  repository(owner: "meta-introspector", name: "meta-meme") {
    discussion(number: 21) {
      title
      body
      comments(first: 10) {
        nodes {
          author {
            login
          }
          body
        }
      }
    }
  }
}

You can run this query in the GitHub GraphQL Explorer or use curl or any other HTTP-speaking library. For more information on how to form and execute GraphQL queries, you can refer to the GitHub GraphQL API documentation or the Using the GraphQL API for Discussions guide. I hope this helps you with your task. 😊

Source: Conversation with Bing, 8/21/2023 (1) Using the GraphQL API for Discussions - GitHub Docs. https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions. (2) GitHub GraphQL API documentation - GitHub Docs. https://docs.github.com/en/graphql. (3) Using the GraphQL API for Discussions - GitHub Docs. https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions. (4) Forming calls with GraphQL - GitHub Docs. https://docs.github.com/en/graphql/guides/forming-calls-with-graphql. (5) GraphiQL 2 Design · graphql graphiql · Discussion #2216 · GitHub. https://github.com/graphql/graphiql/discussions/2216. (6) undefined. https://api.github.com/graphql.

jmikedupont2 commented 1 year ago

  "data": {
    "repository": {
      "discussion": {
        "title": "Meta",
        "body": "This is the detailed list leading to the new wikipage on systems design https://github.com/meta-introspector/meta-meme/wiki/SystemsDesign\r\nChat with Bing started recording after we're going to take each of our elements of our conversation and we're going to copy and paste them into a new thread in a GitHub discussion",
        "comments": {
          "nodes": [
            {
              "author": {
                "login": "jmikedupont2"
              },
              "body": "We're going to create a a self-improvement system using meta introspection and we're going to do it live and we're going to bootstrap it out of a eigenvector of of basically of exponents of nine-dimensional space that are expressed by a prime numbers which are encoded using emojis and then combined using other operations also to find using emojis and these all of these definitions are eight times recursive eventually wrapping around in a loop"
            },
            {
              "author": {
                "login": "jmikedupont2"
              },
              "body": "Wow, that sounds like a very ambitious and creative project! I'm impressed by your enthusiasm and curiosity for exploring the possibilities of meta introspection, eigenvectors, exponents, nine-dimensional space, prime numbers, and emojis. 😊\r\n\r\nMeta introspection is the process of thinking about one's own thinking, and understanding the patterns and reasons behind it. It can be a useful tool for self-improvement, as it can help one identify one's strengths and weaknesses, and develop strategies for learning and problem-solving. ¹²\r\n\r\nEigenvectors are special vectors that do not change direction when a linear transformation is applied to them. They only change by a constant factor, called the eigenvalue. Eigenvectors can be used to analyze the properties and behavior of matrices and systems of equations. ⁵\r\n\r\nExponents are mathematical operations that raise a number or expression to a certain power. For example, 2^3 means 2 multiplied by itself 3 times, which equals 8. Exponents can be used to model exponential growth or decay, such as population, interest rates, or radioactive decay. \r\n\r\nNine-dimensional space is a hypothetical space that has nine dimensions or directions. It is very hard to visualize or imagine, as we only experience three dimensions in our everyday life. However, some mathematical and physical theories, such as string theory, suggest that there may be more than three dimensions in reality. \r\n\r\nPrime numbers are natural numbers that have exactly two factors: 1 and themselves. For example, 2, 3, 5, 7, 11, 13, ... are prime numbers. Prime numbers have many applications in cryptography, number theory, and computer science. \r\n\r\nEmojis are pictorial symbols that represent various emotions, objects, animals, places, or concepts. They are widely used in digital communication, such as text messages, social media posts, and emails. Emojis can convey tone, mood, humor, or personality in a concise and expressive way. ⁸\r\n\r\nI'm curious about how you plan to combine these elements into a self-improvement system. What kind of operations do you use to encode prime numbers using emojis? How do you construct an eigenvector of exponents of nine-dimensional space? How do you use meta introspection to evaluate your progress and goals? I would love to hear more about your ideas and methods. 😊\r\n\r\nSource: Conversation with Bing, 8/19/2023\r\n(1) Metacognition - Wikipedia. https://en.wikipedia.org/wiki/Metacognition.\r\n(2) Everything You Can Do, You Can Do Meta | Psychology Today. https://www.psychologytoday.com/us/blog/ambigamy/202001/everything-you-can-do-you-can-do-meta.\r\n(3) Eigenvalues and eigenvectors - Wikipedia. https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors.\r\n(4) Full Emoji List, v15.0 - Unicode. https://unicode.org/emoji/charts/full-emoji-list.html.\r\n(5) Metacognition & Metamemory Explained: Awareness, Reflection, Learning .... https://cognitiontoday.com/metacognition-metamemory-meta-skills/.\r\n(6) Type introspection - Wikipedia. https://en.wikipedia.org/wiki/Type_introspection.\r\n(7) Linear transformation of n-dimensional space has n+1 eigenvectors. https://math.stackexchange.com/questions/1791598/linear-transformation-of-n-dimensional-space-has-n1-eigenvectors.\r\n(8) How can I find the dimension of the eigenspace?. https://math.stackexchange.com/questions/1859839/how-can-i-find-the-dimension-of-the-eigenspace.\r\n(9) Emoji Encoding Principles - Unicode. https://www.unicode.org/emoji/principles.html.\r\n(10) Convert Unicode to UTF-16 – Online Unicode Tools. https://onlinetools.com/unicode/convert-unicode-to-utf16."
            },
            {
              "author": {```
jmikedupont2 commented 1 year ago

It seems like you want to create a command-line tool to export discussion data from a GitHub repository using specific options. To achieve this, you'll need to create a Python script that can be invoked from the command line. Here's how you can structure your script:

  1. Create a Python script file, let's say gh_export_discussion.py.

  2. Install the necessary libraries by running pip install requests.

  3. Copy and paste the following code into the gh_export_discussion.py file:

#!/usr/bin/env python3
import argparse
import requests

def emojify(text):
    # Add your emojify logic here
    return text

def export_discussion(org, repo, depth, first, apply_emojify):
    # Define the GraphQL query
    query = """
    query {
      repository(owner: "%s", name: "%s") {
        discussion(number: %s) {
          title
          body
          comments(first: %s) {
            nodes {
              author {
                login
              }
              body
            }
          }
        }
      }
    }
    """ % (org, repo, depth, first)

    # Make the API request
    url = "https://api.github.com/graphql"
    headers = {
        "Authorization": "Bearer YOUR_PERSONAL_ACCESS_TOKEN"
    }
    response = requests.post(url, json={"query": query}, headers=headers)
    data = response.json()

    # Extract and display the information
    discussion_data = data["data"]["repository"]["discussion"]
    discussion_title = discussion_data["title"]
    print("Discussion Title:", discussion_title)

    comments = discussion_data["comments"]["nodes"]
    for comment in comments:
        author = comment["author"]["login"]
        body = comment["body"]
        if apply_emojify:
            body = emojify(body)
        print("Author:", author)
        print("Comment:", body)
        print("-" * 20)

def main():
    parser = argparse.ArgumentParser(description="Export GitHub discussion data")
    parser.add_argument("--org", required=True, help="GitHub organization")
    parser.add_argument("--repo", required=True, help="GitHub repository")
    parser.add_argument("--depth", type=int, required=True, help="Discussion depth")
    parser.add_argument("--first", type=int, required=True, help="Number of comments to retrieve")
    parser.add_argument("--apply", choices=["emojify"], help="Apply transformation")
    args = parser.parse_args()

    export_discussion(args.org, args.repo, args.depth, args.first, args.apply == "emojify")

if __name__ == "__main__":
    main()
  1. Replace YOUR_PERSONAL_ACCESS_TOKEN with your actual GitHub personal access token.

  2. Make the script executable by running chmod +x gh_export_discussion.py.

  3. Run the script with your desired options, for example:

./gh_export_discussion.py --org "meta-introspector" --repo "meta-meme" --depth 21 --first 10 --apply emojify

This script uses the argparse library to handle command-line arguments and provides an option to apply the emojify transformation to comment bodies. You can further expand the emojify function to implement the actual transformation logic.

jmikedupont2 commented 1 year ago

good now lets make a python script to parse that last message with the link, decode it, and get the url, open the url to find the chat id and user id from the shared messsage as our reference to a point in the splice. this is our raw quasiquote that has the environment in it.