-
Notifications
You must be signed in to change notification settings - Fork 1
/
steve.py
135 lines (114 loc) · 4.04 KB
/
steve.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import os
import logging
import discord
from dotenv import load_dotenv
from discord import Activity, ActivityType, AllowedMentions
from discord.ext import commands
from discord.ext.commands import when_mentioned_or
from modules.dbl import TopGG
from modules.profile import Profile
from modules.stats import Stats
from modules.info import Info
load_dotenv()
environ = os.getenv("ENVIRON")
logging.basicConfig(level=logging.INFO)
intents = discord.Intents.default()
intents.typing = True
intents.presences = False
# intents.members = True
client = commands.Bot(
command_prefix=when_mentioned_or("mc "),
help_command=None,
allowed_mentions=AllowedMentions.none(),
intents=intents,
)
@client.event
async def on_ready():
await client.change_presence(
activity=Activity(
type=ActivityType.watching, name="you getting all that experience."
)
)
logging.info(f"=====Bot is running as: {client.user}=====")
@client.event
async def on_guild_join(guild):
channel = guild.system_channel
embed = discord.Embed(
colour=0x2859B8,
description="""Hello, Thanks for adding Steve✨
Steve is a simple and easy to use Discord bot that knows everything about Minecraft. About blocks, items, mobs, recipes, and even players!!
Simply use the help command (`mc help`) to get started!""",
)
embed.add_field(name="**__Links__**", inline=False, value="\u200b")
embed.add_field(
name="Community Server",
value="[Steve✨ Community](https://discord.gg/dKVfhV2jfn)",
)
embed.add_field(
name="Invite",
value="[Add Steve✨ to your server](https://discord.com/api/oauth2/authorize?client_id=784725037172129803&permissions=379968&scope=bot)",
)
embed.add_field(
name="Top.gg page",
value="[Steve✨](https://top.gg/bot/784725037172129803)",
)
await channel.send(embed=embed)
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
return
embed = discord.Embed(
title="Oops, Steve✨ fell into an error!",
colour=ctx.author.colour,
description=f"{error}",
)
embed.set_image(url="https://f.sed.lol/files/r6MhW.gif")
await ctx.send(embed=embed)
print(error)
@client.command()
async def help(ctx):
async with ctx.channel.typing():
embed = discord.Embed(
title="Help",
colour=ctx.author.colour,
description="Here is a list of commands you can use:",
)
embed.add_field(
name="Info",
inline=False,
value=f"`{ctx.prefix}about <entity>` - Get info about anything in Minecraft.\n`{ctx.prefix}wiki <entity>` "
f"- Get the link to official wiki page of that entity.\n`{ctx.prefix}craft <item>` - Get the "
f"crafting recipe for any item.\n`{ctx.prefix}profile <player>` - Get the Minecraft profile of any "
f"player.\n`{ctx.prefix}server <server address>` - Get info about any valid Minecraft Java Server.",
)
embed.add_field(
name="Developer",
inline=False,
value=f"`{ctx.prefix}stats` - Some statistics about the bot.",
)
embed.add_field(
name="\u200b", inline=False, value="More commands coming soon..."
)
await ctx.send(embed=embed)
@client.command()
async def ping(ctx):
async with ctx.channel.typing():
embed = discord.Embed(
title="Ping",
colour=ctx.author.colour,
description=f"Pong! `Latency: {round(client.latency * 1000)} ms`",
)
await ctx.send(embed=embed)
@client.command()
async def invite(ctx):
await ctx.send(
"https://discord.com/api/oauth2/authorize?client_id=784725037172129803&permissions=379968&scope=bot"
)
client.add_cog(Info(client))
client.add_cog(Profile(client))
client.add_cog(Stats(client))
if environ == "PROD":
client.add_cog(TopGG(client))
client.run(os.getenv("BOT_TOKEN"))
elif environ == "DEV":
client.run(os.getenv("DEV_BOT_TOKEN"))