Random Greeting Generator

  • Share this:

Code introduction


This function randomly returns a greeting when a message is received.


Technology Stack : Discord.py

Code Type : Function

Code Difficulty : Intermediate


                
                    
import discord
import random

def create_random_greeting(message):
    # This function creates a random greeting when a message is received.
    greetings = ["Hello!", "Hi there!", "Hey!", "Greetings!", "What's up?"]
    return random.choice(greetings)

# Code Information                
              
Tags: