1
1
import discord
2
- import json
2
+ import json , os
3
3
from discord .ext import commands
4
4
5
+ if not os .path .exists ("config.json" ):
6
+ with open ("config.json.example" ) as f :
7
+ with open ("config.json" , "w" ) as w :
8
+ w .write (f .read ())
9
+
5
10
with open ('config.json' ) as f :
6
11
configData = json .load (f )
12
+ f .close ()
7
13
8
14
client = commands .Bot (command_prefix = configData ['prefix' ])
9
15
10
16
@client .event
11
17
async def on_ready ():
12
- activity = discord .Game (name = "PyCharm vs. Jupyter vs. Visual Studio Code" , type = 1 )
18
+ activity = discord .Game (name = configData [ "status" ] , type = 1 )
13
19
await client .change_presence (status = discord .Status .online , activity = activity )
14
20
print ('Bot is ready' )
15
21
16
22
@client .command ()
17
- async def branch (ctx , arg ):
23
+ async def branch (ctx , arg = "develop" ):
18
24
await ctx .send (f'You can access the { arg } branch by running ``git checkout { arg } ``' )
19
25
20
26
@client .command ()
21
- async def repo (ctx , arg ):
27
+ async def repo (ctx , arg = "main" ):
22
28
if (arg == 'main' or arg == 'mcpy' ):
23
29
await ctx .send ('The github repo for McPy is located at https://github.com/mcpyproject/McPy' )
24
30
if (arg == 'bot' ):
@@ -29,7 +35,7 @@ async def tryitandsee(ctx):
29
35
await ctx .send ("It's now time to https://tryitands.ee" )
30
36
31
37
@client .command ()
32
- async def install (ctx , arg ):
38
+ async def install (ctx , arg = "python" ):
33
39
if (arg == 'python3' or arg == 'python3.8' or arg == 'python' ):
34
40
await ctx .send ('Python 3.8 can be installed by following the instructions at https://www.python.org/downloads/release/python-387/' )
35
41
if (arg == 'submodules' or arg == 'submodule' ):
0 commit comments