MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / main

Function main

scripts/setup_discord.py:115–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113
114
115def main():
116 print("\n" + "=" * 80)
117 print(" Discord Bot Setup for AgentSPEX")
118 print("=" * 80)
119
120 # Step 1: Create app & bot
121 print("\n[1/5] Create a Discord Application & Bot...")
122 print_box(
123 [
124 "1. Go to: https://discord.com/developers/applications",
125 "2. Click 'New Application' and give it a name",
126 "3. Go to the 'Bot' tab in the sidebar",
127 "4. Scroll to 'Privileged Gateway Intents' and enable:",
128 " ✓ MESSAGE CONTENT INTENT ← REQUIRED or the bot will fail to start",
129 " ✓ SERVER MEMBERS INTENT ← optional, for display names",
130 "5. Click 'Save Changes' — do not skip this or the listener will error",
131 ],
132 title="Discord Developer Portal",
133 )
134 input("\n Press Enter when you've created the bot and enabled the intents...")
135
136 # Step 2: Get bot token
137 print("\n[2/5] Get Bot Token...")
138 print_box(
139 [
140 "Copy your bot token:",
141 "",
142 "1. Go to the 'Bot' tab at https://discord.com/developers/applications",
143 "2. Click 'Reset Token' (you may need to confirm with 2FA)",
144 "3. Copy the token that appears",
145 "",
146 "Keep this token secret — it grants full control of your bot.",
147 ],
148 title="Bot Token",
149 )
150
151 bot_token = ""
152 application_id = ""
153 while True:
154 bot_token = input("\n Enter Bot Token: ").strip()
155 if not bot_token:
156 print_error("Token is required")
157 continue
158
159 valid, message = validate_bot_token(bot_token)
160 if valid:
161 print_success(f"Token validated — {message}")
162 application_id = get_application_id(bot_token) or ""
163 break
164 else:
165 print_error(f"Invalid token: {message}")
166 retry = input(" Try again? [Y/n]: ").strip().lower()
167 if retry == "n":
168 print_info("Continuing with unvalidated token...")
169 break
170
171 # Step 3: Slash command name
172 print("\n[3/5] Slash Command Name...")

Callers 1

setup_discord.pyFile · 0.70

Calls 9

get_application_idFunction · 0.85
build_invite_urlFunction · 0.85
print_boxFunction · 0.70
print_errorFunction · 0.70
validate_bot_tokenFunction · 0.70
print_successFunction · 0.70
print_infoFunction · 0.70
update_vm_envFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected