-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
98 lines (83 loc) · 2.69 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import discord
import random
from discord.ext import commands
bot = commands.Bot(command_prefix = "ac")
# tells us when bot is online in console
@bot.event
async def on_ready():
print("Bot is online.")
# tells us when someone has joined the server
@bot.event
async def on_member_join(member):
await ctx.send(f"{member} has joined the server!")
# shows server ping command
@bot.command()
async def ping(ctx):
await ctx.send(f"**Pong!**\nLatency: {round(bot.latency * 1000)}ms")
# calls 'name' a bot command
@bot.command()
async def isabot(ctx, *, name):
if "327898244703322122" in name or "ac" == name or "AC" == name:
await ctx.send("no u.")
else:
await ctx.send(f"{name} is a bot!")
# 8ball command
@bot.command(aliases=["8ball"])
async def _8ball(ctx, *, question):
if "327898244703322122" in question or "ac" == question or "AC" == question:
await ctx.send(f"**Question:** {question}\n**Answer:** If it's a good thing, yes. If it's a bad thing, no.")
else:
responses = [
"It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."]
await ctx.send(f"**Question:** {question}\n**Answer:** {random.choice(responses)}")
# clear command
@bot.command()
@commands.has_permissions(manage_messages=True)
async def clear(ctx, amount):
await ctx.channel.purge(limit=int(amount)+1)
# kick user
@bot.command()
# @commands.has_permissions(kick_members=True)
async def kick(ctx, member : discord.Member, *, reason=None):
await member.kick(reason=reason)
# ban user
@bot.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member, *, reason=None):
await member.ban(reason=reason)
# @bot.event
# async def on_message(msg):
# print("{} user has sent a message in {}".format(msg.author.name,msg.channel.name))
# #whatever you want to do with the XP system
# @bot.command(pass_context=True)
# @commands.has_role("On Leave")
# async def something(ctx, user: discord.Member):
# role = discord.utils.find(lambda r: r.name == 'Member', ctx.message.server.roles)
# if role not in user.roles:
# await bot.say("{} is not muted".format(user))
# else:
# await bot.add_roles(user, role)
@bot.command()
@commands.is_owner()
async def shutdown(ctx):
await ctx.bot.logout()
bot.run("NjU5OTIwNzkxNjQ2NzY1MTI2.XgVVUg.7iZYmQCVhL44gElIMvfPIwBR-O0")