{"id":21719443,"url":"https://github.com/paramt/q4t","last_synced_at":"2025-10-09T05:34:06.482Z","repository":{"id":98576558,"uuid":"247986563","full_name":"paramt/Q4T","owner":"paramt","description":"Post scheduled quizzes on Telegram using a list of questions from Google Sheets","archived":false,"fork":false,"pushed_at":"2024-05-21T06:44:26.000Z","size":50,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T20:45:00.300Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paramt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-17T14:10:19.000Z","updated_at":"2024-01-07T02:46:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"8b9bc552-cae3-4632-84e4-9680706b0514","html_url":"https://github.com/paramt/Q4T","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/paramt/Q4T","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramt%2FQ4T","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramt%2FQ4T/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramt%2FQ4T/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramt%2FQ4T/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paramt","download_url":"https://codeload.github.com/paramt/Q4T/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramt%2FQ4T/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000741,"owners_count":26082932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T01:37:39.406Z","updated_at":"2025-10-09T05:34:06.446Z","avatar_url":"https://github.com/paramt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :pencil: Scheduled Quizzes for Telegram\n\u003e Post scheduled quizzes on Telegram using a list of questions from Google Sheets\n\n## :electric_plug: Set up\n1. Click the \u003ckbd\u003eUse this template\u003c/kbd\u003e button on GitHub and create a **private repository**\n1. Create a Telegram bot\n    - Follow [these instructions](https://core.telegram.org/bots#creating-a-new-bot) to generate a token\n    - Add your token to `config.py`\n    - Add the bot to your channel or group and promote it to administrator\n1. Connect to Google Sheets\n    - Go to [Google Developer Console](https://console.developers.google.com/apis/dashboard) and create a new project\n    - Click \u003ckbd\u003e+ ENABLE APIS AND SERVICES\u003c/kbd\u003e and enable the \"Drive API\" as well as the \"Sheets API\"\n    - Navigate to \"APIs and Services\" \u003e \"Credentials\"\n    - Click \u003ckbd\u003e+ CREATE CREDENTIALS\u003c/kbd\u003e and select \"Service account\"\n    - Fill in the required fields, press \u003ckbd\u003eCREATE\u003c/kbd\u003e, \u003ckbd\u003eCONTINUE\u003c/kbd\u003e, and on the last step click \u003ckbd\u003e+ CREATE KEY\u003c/kbd\u003e to download a JSON file\n    - Upload the JSON file at the root of your GitHub repo and add the filename to the `credentials` variable in `config.py`\n    - Copy the [Google sheet template](https://docs.google.com/spreadsheets/u/1/d/1BE-ZbrkTejJloU_d953nYCKCqVSfoiQQCZ45Y3NSdtc/copy) and share it with the email address found in `client_email` in the JSON file\n1. Configure options in `config.py`\n    \n| Option | Description | Type | Example |\n| ------ | ----------- | ---- | ------- |\n| `spreadsheet` | **Required** - The name of your Google sheet | String | Q4T Template |\n| `channel` | **Required** - The unique identifier of your chat or the username of your channel (the part after t.me/ in the invite URL) | String | q4t_playground |\n| `loop` | Whether of not the bot should loop through the questions if all the questions have been exhausted | Boolean | `True` |\n| `anonymous` | Whether to keep the responses anonymous (Note: this *must* be set to `True` for channels) | Boolean | `True` |\n\n**:warning: Make sure your repository is private, because your Google credentials and Telegram token is sensitive information.**\n\n## :desktop_computer: Usage\nYou can add as many question/answer sets in your Google sheet as you want. You can also send an image alongside each question by providing the link to the image. The image will be sent immediately before the question. Everytime the script is run, it will send a quiz to the target chat or channel and increment the index in the `index` sheet. You can keep adding more question/answer sets indefinitely.\n\n### Run at scheduled interval\nTo send quizzes at a certain interval, run `src/main.py` at the specific interval. The recommended way to do this is to use [GitHub Actions](https://github.com/features/actions). Here is a sample workflow you can put in `.github/workflows/main.yml` to send a quiz every day:\n\n```yml\nname: Send quiz\non:\n  schedule:\n  - cron: '0 0 * * *'\n\njobs:\n  run:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v1\n    - uses: actions/setup-python@v1\n      with:\n        python-version: '\u003e=3.6'\n    - name: Install dependencies\n      run: pip install -r requirements.txt\n\n    - name: Send quiz\n      run: python src/main.py\n```\n\n### Reset\nTo reset the spreadsheet, simply run `reset.py`. This will remove all questions and set the index to 2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamt%2Fq4t","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparamt%2Fq4t","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamt%2Fq4t/lists"}