Skip to content

JCPetrelli/Chuck-Norris-Jokes-for-MS-Teams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Chuck Norris Joke Generator

This Python script generates a Chuck Norris joke and personalizes it with a random name from a list. The joke is then sent to a Microsoft Teams channel via a webhook.

Requirements

  • Python 3.6+
  • pymsteams
  • requests

Installation

  1. Clone this repository or download the files
  2. Install the required dependencies:
pip install pymsteams requests

Alternatively, if you have a requirements.txt file:

pip install -r requirements.txt

Setup

  1. Get a Microsoft Teams Webhook URL:

  2. Configure the script:

    • Open start_chuck.py
    • Replace Insert_Here_Your_MS_Teams_Webhook_URL on line 25 with your actual Microsoft Teams webhook URL

Usage

Run the script with:

python start_chuck.py

The script will:

  1. Fetch a random Chuck Norris joke from the API
  2. Replace "Chuck Norris" with a random name from the predefined list
  3. Send the personalized joke to your Microsoft Teams channel

Customization

  • Names: You can modify the list_of_names on line 14 to add or remove names for personalization
  • Scheduling: Set up the script to run automatically using crontab (Linux/Mac) or Task Scheduler (Windows)

Example crontab entry (runs daily at 9 AM):

0 9 * * * /usr/bin/python3 /path/to/start_chuck.py

How It Works

  1. API Call: Fetches a random joke from https://api.chucknorris.io/jokes/random
  2. Name Selection: Chooses a random name from the predefined list
  3. Personalization: Creates a "Norrized" version by replacing the last name with "Norris"
  4. Text Replacement: Substitutes "Chuck Norris" in the joke with the personalized name
  5. Teams Integration: Sends the joke to Microsoft Teams via webhook

File Structure

.
├── README.md           # This documentation
├── start_chuck.py      # Main script
├── requirements.txt    # Python dependencies (optional)
└── .gitignore         # Git ignore patterns

Troubleshooting

  • Module not found errors: Make sure you've installed the requirements with pip install pymsteams requests
  • Webhook errors: Verify your Teams webhook URL is correct and the channel is accessible
  • API errors: The Chuck Norris API is free and doesn't require authentication, but check your internet connection

Disclaimer

I am not responsible for the inappropriate use of the jokes generated by this script. Please use it at your own discretion and make sure to follow the guidelines and policies of your organization or platform.

Credits

About

This Python script generates a Chuck Norris joke and personalizes it with a random name from a list. The joke is then sent to a Microsoft Teams channel via a webhook.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages