aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-12-16 09:50:35 +0530
committerVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-12-16 09:50:35 +0530
commitc9834b5e7db581decea1e80086a32d706dd10b8a (patch)
tree022fdf33ce0ac53e58a36092762eaaaa48ca0f12
parent8612a9ed856f0b37b9b46505f2b188306f37400b (diff)
added randomized greetings
-rw-r--r--bot.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/bot.py b/bot.py
index 703ee2c..6333c7f 100644
--- a/bot.py
+++ b/bot.py
@@ -1,13 +1,16 @@
import discord
+import os
+from dotenv import load_dotenv
import random
-import os # why
# from hentai import hentai
-from dotenv import load_dotenv
-# z!info
-INFO_MESSAGE = "Discord bot created by Vidhu Kant Sharma"
+greetings = ["Greetings.", "Hello.", "Hey!", "Yahallo!", "Namaskar,", "Konnichiwa,", "Yo!"]
+def get_info():
+ info_messages = [random.choice(greetings) + " I'm a Discord bot created by Vidhu Kant Sharma", "This bot is pog"]
+ return random.choice(info_messages)
-greetings = ["Greetings", "Hello", "Hey", "Yahallo", "Namaskar", "Konnichiwa", "Yo"]
+CALL = "z!"
+HELP_MESSAGE = '```Every command should be prefixed with "' + CALL + '".\nsay repeats your previous message\ninfo displays info about the bot and the creator\nhelp shows this message```'
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
@@ -27,15 +30,17 @@ async def on_message(message):
if message.author == client.user:
return
- if message.content[0:6] == 'z!say ':
+ if message.content[0:len(CALL) + 4] == CALL + 'say ':
response = message.content[5:]
await message.channel.send(response)
-
- if message.content == 'z!info':
- response = INFO_MESSAGE
+ if message.content == CALL + 'info':
+ response = get_info()
await message.channel.send(response)
+ if message.content == CALL + 'help':
+ response = HELP_MESSAGE
+ await message.channel.send(response)
client.run(TOKEN)