Repository navigation
Expand file tree
/
Copy pathbot.py
More file actions
66 lines (52 loc) · 1.86 KB
/
Copy pathbot.py
File metadata and controls
66 lines (52 loc) · 1.86 KB
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
58
59
60
61
62
63
64
65
66
import discord
from discord.ext import commands
import config
import random
bot = commands.Bot(command_prefix = config.PREFIX)
bot.remove_command('help')
@bot.command()
async def joined(ctx, *, member: discord.Member):
await ctx.send('**{0.name}**'' joined on {0.joined_at}'.format(member))
@bot.command(aliases =['hi'])
async def hello(ctx):
await ctx.send(f'Hello, {ctx.message.author.mention}')
@bot.command()
async def say(ctx, *, arg):
await ctx.send(arg)
@bot.command()
async def slap(ctx, members: commands.Greedy[discord.Member], *, reason='no reason'):
slapped = ", ".join(x.name for x in members)
await ctx.send('**{}** just got slapped for {}'.format(slapped, reason))
@bot.command()
async def prefix(ctx, arg):
config.PREFIX.pop(0)
config.PREFIX.append(arg)
await ctx.send('Prefix succesfully changed to \"{}\"'.format(arg))
@bot.command(aliases=['h'])
async def help(ctx):
embedVar = discord.Embed(title="Simple title", description="Nah, don't try to find a normal description here",
color=0x277ecd)
embedVar.add_field(name="-help", value="It's fixed now :D", inline=True)
embedVar.add_field(name="-slap", value="Slap someone", inline=False)
await ctx.send(embed=embedVar)
@bot.command(pass_context = True)
@commands.has_role("Test")
async def ping(ctx):
await ctx.send(f'{round(bot.latency * 1000)}ms')
@bot.event
async def on_ready():
print("Bot is ready!")
@bot.event
async def on_message_delete(ctx):
author = ctx.author
content = ctx.content
channel = ctx.channel
print ('{} deleted message: {}'.format(author, content))
# await channel.send('**{}** deleted message: {}'.format(author, content))
@bot.event
async def on_message(ctx):
if ctx.content.startswith('secret word'):
await ctx.channel.send("ACCEPTED")
else:
await bot.process_commands(ctx)
bot.run(config.TOKEN)