-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.py
56 lines (45 loc) · 1.67 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import discord
import os
from discord import message
import requests
import json
import random
from dotenv import load_dotenv
from cusswords import badwords,starter_response_to_cussWords
load_dotenv()
client = discord.Client()
def get_quote():
response = requests.get('https://zenquotes.io/api/random')
json_data = json.loads(response.text)
quote = json_data[0]['q']
return(quote)
def get_dadJoke():
response = requests.get("https://icanhazdadjoke.com/", headers={"Accept": "application/json"})
json_data = json.loads(response.text)
joke = json_data['joke']
return joke
def get_activity():
response = requests.get('https://www.boredapi.com/api/activity')
json_data = json.loads(response.text)
activity = json_data['activity']
return (activity)
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
msg = message.content
if message.content.startswith('bsdk'):
await message.channel.send("Jubaan sambhaal ke, varna iss server ki membership se bedahkal karr diye jaoge")
if message.content.startswith('motivate me daddy'):
await message.channel.send(get_quote())
if message.content.startswith('make me laugh daddy'):
await message.channel.send(get_dadJoke())
if message.content.startswith('I am bored daddy'):
activity = get_activity()
await message.channel.send(f'Are you bored ? ...{activity}')
if any(word in msg for word in badwords):
await message.channel.send(random.choice(starter_response_to_cussWords))
client.run(os.getenv("TOKEN"))