-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
57 lines (42 loc) · 1.47 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
57
import discord
from discord.ext import commands, tasks
from Data import config
import requests # make http requests and returns .json files
import json
import random, os
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " -" + json_data[0]['a']
return quote
# class Client(discord.Client):
# async def on_ready(self):
# print('{0} is logged in !'.format(self.user))
# async def on_message(self, message):
# if(message.author == self.user):
# return
# if(message.content.startswith(config.prefix)):
# return
# if(message.content.startswith(config.prefix+'hi' or config.prefix+'hello')):
# await message.channel.send('Hello there!')
# if(message.content.startswith(config.prefix + 'inspire')):
# await message.channel.send(get_quote())
#@commands.command()
#async def test(ctx):
# pass
#client = Client()
client = commands.Bot(command_prefix= config.prefix)
@client.event
async def on_ready():
print('LeoneBot is logged in !')
extensions= os.listdir('cogs')
print(extensions)
if __name__ == '__main__':
for ext in extensions:
if '.py' in ext:
client.load_extension('cogs.'+ ext.removesuffix('.py'))
# extensions = 'cogs.CommandEvents'
# if __name__ == '__main__':
# for ext in extensions:
# client.load_extension(ext)
client.run(config.token)