forked from RealJammy/The-Jambot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
53 lines (43 loc) · 1.76 KB
/
bot.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
import discord
from discord.ext import commands
from discord.ext.commands import has_permissions, MissingPermissions
import json
client = commands.Bot(command_prefix = '.')
client.remove_command('help')
with open("creds.json", "r") as creds:
data = json.load(creds)["creds"]
token = data["bot_token"]
@client.event
async def on_ready():
print('The Jambot is here. Hello.')
await client.change_presence(status=discord.Status.online, activity=discord.Game('Watching over skids'))
@client.event
async def on_member_join(self, member):
channel = discord.utils.get(message.guild.channels, name='general')
await channel.send(f'{member} has joined the server. :smile:')
@client.event
async def on_member_remove(self, member):
channel = discord.utils.get(message.guild.channels, name='general')
await channel.send(f'{member} has left the server. :pensive:')
@client.event
async def on_commmand_error(self, ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Please give all the arguments.')
print(f"ERROR: {error}")
# @client.command(brief = 'Reloads cog.', description = 'Do ";reload cog".')
# @has_permissions(administrator = True)
# async def reload(ctx, extension):
# if ctx.message.author.id == 448519423901433876:
# client.unload_extension(f'cogs.{extension}')
# client.load_extension(f'cogs.{extension}')
# else:
# await ctx.send("You must be Jammy.")
# return
# await ctx.send(f'Successfully reloaded "{extension}".')
#bot hosted on heroku command not needed
client.load_extension('cogs.fun')
client.load_extension('cogs.admin')
client.load_extension('cogs.useful')
client.load_extension('cogs.reddit')
client.load_extension('cogs.maths')
client.run(token)#api key here :)