-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
51 lines (40 loc) · 1.4 KB
/
Copy pathsetup.py
File metadata and controls
51 lines (40 loc) · 1.4 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
#!/usr/bin/env python3
"""
Setup script for GitCord Discord Bot
This script helps you create the necessary .env file with your Discord bot token.
"""
import os
def create_env_file():
"""Create .env file with user input."""
print("=== GitCord Bot Setup ===")
print("This script will help you create the .env file with your Discord bot token.")
print()
# Check if .env already exists
if os.path.exists('.env'):
print("Warning: .env file already exists!")
overwrite = input("Do you want to overwrite it? (y/N): ").lower().strip()
if overwrite != 'y':
print("Setup cancelled.")
return
# Get Discord token from user
print("Please enter your Discord bot token:")
print("(You can get this from https://discord.com/developers/applications)")
print()
token = input("Discord Bot Token: ").strip()
if not token:
print("Error: Token cannot be empty!")
return
# Create .env file
try:
with open('.env', 'w') as f:
f.write(f"DISCORD_TOKEN={token}\n")
print()
print("✅ .env file created successfully!")
print("You can now run the bot with: python bot.py")
except Exception as e:
print(f"Error creating .env file: {e}")
def main():
"""Main setup function."""
create_env_file()
if __name__ == "__main__":
main()