You can download this code by clicking the button below.
This code is now available for download.
This function takes a message object as an argument and returns a random greeting followed by a mention of the message sender.
Technology Stack : Discord.py
Code Type : Discord API Function
Code Difficulty : Intermediate
import discord
import random
def create_random_greeting(message):
greetings = ["Hello", "Hi", "Hey", "Greetings", "Salutations"]
random_greeting = random.choice(greetings)
return f"{random_greeting}, {message.author.mention}!"