Spaces:
Running
Running
File size: 57,868 Bytes
2139814 | 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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ServerDev | Template Builder</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Roboto+Mono:wght@300;400;500;600&display=swap');
body {
font-family: 'Roboto Mono', monospace;
background-color: #0a0a0a;
color: #e0e0e0;
overflow-x: hidden;
}
.title-font {
font-family: 'Orbitron', sans-serif;
}
.glow-text {
text-shadow: 0 0 8px rgba(0, 150, 255, 0.7);
}
.glow-box {
box-shadow: 0 0 15px rgba(0, 150, 255, 0.3);
}
.cyber-border {
position: relative;
border: 1px solid transparent;
}
.cyber-border::before {
content: '';
position: absolute;
inset: 0;
border-radius: 0.5rem;
padding: 2px;
background: linear-gradient(135deg, #00f2ff, #0066ff, #00f2ff);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
.input-field {
background-color: rgba(20, 20, 20, 0.8);
border: 1px solid #333;
transition: all 0.3s ease;
}
.input-field:focus {
border-color: #0066ff;
box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
}
.password-btn {
background: linear-gradient(135deg, #0066ff, #00c6ff);
transition: all 0.3s ease;
}
.password-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 102, 255, 0.4);
}
.grid-bg {
background-image:
linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
background-size: 30px 30px;
}
.cyber-loader {
width: 48px;
height: 48px;
border: 3px solid #0066ff;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
.cyber-loader::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 56px;
height: 56px;
border-radius: 50%;
border: 3px solid;
border-color: #00f2ff transparent;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
/* Dashboard styles */
.sidebar {
background-color: rgba(10, 10, 15, 0.8);
backdrop-filter: blur(10px);
border-right: 1px solid rgba(0, 102, 255, 0.2);
}
.nav-item {
transition: all 0.3s ease;
border-left: 3px solid transparent;
}
.nav-item:hover {
background-color: rgba(0, 102, 255, 0.1);
border-left-color: #0066ff;
}
.nav-item.active {
background-color: rgba(0, 102, 255, 0.2);
border-left-color: #0066ff;
}
.dashboard-card {
background-color: rgba(20, 20, 25, 0.6);
backdrop-filter: blur(10px);
border: 1px solid rgba(0, 102, 255, 0.2);
transition: all 0.3s ease;
}
.dashboard-card:hover {
border-color: rgba(0, 102, 255, 0.5);
box-shadow: 0 5px 15px rgba(0, 102, 255, 0.1);
}
/* Template Builder Styles */
.template-item {
background-color: rgba(30, 30, 35, 0.6);
border: 1px solid rgba(0, 102, 255, 0.2);
margin-bottom: 10px;
padding: 12px;
border-radius: 6px;
cursor: move;
transition: all 0.2s ease;
}
.template-item:hover {
background-color: rgba(40, 40, 45, 0.6);
border-color: rgba(0, 102, 255, 0.4);
}
.template-item.dragging {
opacity: 0.5;
background-color: rgba(0, 102, 255, 0.1);
}
.permission-chip {
display: inline-block;
background-color: rgba(0, 102, 255, 0.2);
border: 1px solid rgba(0, 102, 255, 0.3);
border-radius: 4px;
padding: 2px 6px;
margin-right: 4px;
margin-bottom: 4px;
font-size: 12px;
color: #e0e0e0;
}
.channel-icon {
width: 20px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
margin-right: 8px;
border-radius: 4px;
}
.text-channel {
background-color: rgba(100, 149, 237, 0.2);
color: #6495ed;
}
.voice-channel {
background-color: rgba(50, 205, 50, 0.2);
color: #32cd32;
}
.category-channel {
background-color: rgba(255, 165, 0, 0.2);
color: #ffa500;
}
.role-color {
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
margin-right: 8px;
}
.tab-button {
padding: 8px 16px;
border-bottom: 2px solid transparent;
transition: all 0.2s ease;
}
.tab-button.active {
border-bottom-color: #0066ff;
color: #0066ff;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: rgba(30, 30, 35, 0.95);
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
border-radius: 6px;
border: 1px solid rgba(0, 102, 255, 0.3);
}
.dropdown:hover .dropdown-content {
display: block;
}
/* Bot status indicator */
.status-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 6px;
}
.status-online {
background-color: #3ba55c;
}
.status-offline {
background-color: #747f8d;
}
.status-idle {
background-color: #faa61a;
}
.status-dnd {
background-color: #ed4245;
}
</style>
</head>
<body class="grid-bg min-h-screen">
<!-- Login Screen (shown by default) -->
<div id="loginScreen" class="flex items-center justify-center p-4 min-h-screen">
<div class="fixed top-0 left-0 w-full h-full bg-black/50 backdrop-blur-sm z-0"></div>
<div class="relative z-10 w-full max-w-md">
<!-- Main Login Card -->
<div class="bg-gray-900/80 backdrop-blur-md rounded-xl p-8 cyber-border">
<!-- Header -->
<div class="text-center mb-8">
<div class="flex justify-center mb-4">
<lottie-player src="https://assets9.lottiefiles.com/packages/lf20_obhph3sh.json" background="transparent" speed="1" style="width: 100px; height: 100px;" loop autoplay></lottie-player>
</div>
<h1 class="title-font text-3xl font-bold text-white glow-text mb-2">SERVER<span class="text-blue-400">DEV</span></h1>
<p class="text-gray-400">Admin Control Panel</p>
</div>
<!-- Login Form -->
<div class="space-y-6">
<!-- Password Login Form -->
<div id="passwordForm">
<div class="mb-4">
<label for="password" class="block text-sm font-medium text-gray-300 mb-2">Admin Password</label>
<div class="relative">
<input type="password" id="password" class="w-full px-4 py-3 rounded-lg input-field text-white focus:outline-none" placeholder="Enter secret key">
<button onclick="togglePasswordVisibility()" class="absolute right-3 top-3 text-gray-400 hover:text-white">
<i class="fas fa-eye"></i>
</button>
</div>
</div>
<button onclick="checkPassword()" class="w-full py-3 px-4 rounded-lg font-medium text-white password-btn flex items-center justify-center space-x-2">
<span>Authenticate</span>
<i class="fas fa-lock"></i>
</button>
</div>
<!-- Loading State -->
<div id="loadingState" class="hidden flex-col items-center justify-center space-y-4 py-8">
<div class="cyber-loader"></div>
<p class="text-blue-400">Authenticating...</p>
</div>
<!-- Error Message -->
<div id="errorMessage" class="hidden bg-red-900/50 border border-red-700 rounded-lg p-4 text-red-200 text-sm"></div>
</div>
</div>
<!-- Footer -->
<div class="mt-6 text-center text-xs text-gray-600">
<p>ServerDev Bot © 2023 | Secure Admin Portal</p>
</div>
</div>
</div>
<!-- Dashboard Screen (hidden by default) -->
<div id="dashboardScreen" class="hidden min-h-screen">
<!-- Sidebar -->
<div class="sidebar fixed top-0 left-0 w-64 h-full z-20">
<div class="p-4 flex items-center space-x-3 border-b border-gray-800/50 pb-6">
<div id="botAvatar" class="w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center overflow-hidden">
<i class="fas fa-robot text-white"></i>
</div>
<div>
<h2 class="font-bold text-white">ServerDev</h2>
<p class="text-xs text-gray-400">Template Builder</p>
<div class="flex items-center mt-1">
<span id="botStatus" class="status-indicator status-offline"></span>
<span id="botStatusText" class="text-xs text-gray-400">Offline</span>
</div>
</div>
</div>
<nav class="p-4 space-y-1">
<a href="#" class="nav-item active flex items-center space-x-3 p-3 rounded-lg text-white">
<i class="fas fa-layer-group w-5 text-center text-blue-400"></i>
<span>Templates</span>
</a>
<a href="#" class="nav-item flex items-center space-x-3 p-3 rounded-lg text-gray-400 hover:text-white">
<i class="fas fa-history w-5 text-center"></i>
<span>Recent Servers</span>
</a>
<a href="#" class="nav-item flex items-center space-x-3 p-3 rounded-lg text-gray-400 hover:text-white">
<i class="fas fa-cog w-5 text-center"></i>
<span>Settings</span>
</a>
</nav>
<div class="absolute bottom-0 left-0 w-full p-4 border-t border-gray-800/50">
<button onclick="logout()" class="w-full flex items-center space-x-3 p-3 rounded-lg text-gray-400 hover:text-red-400 hover:bg-red-900/10 transition">
<i class="fas fa-sign-out-alt w-5 text-center"></i>
<span>Logout</span>
</button>
</div>
</div>
<!-- Main Content -->
<div class="ml-64 p-8">
<div class="flex justify-between items-center mb-8">
<h1 class="title-font text-2xl font-bold text-white">Server Template Builder</h1>
<div class="flex items-center space-x-4">
<div class="flex items-center space-x-2 bg-gray-800/50 px-4 py-2 rounded-lg">
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center">
<i class="fas fa-user text-xs text-white"></i>
</div>
<span class="text-sm font-medium" id="userDisplay">Admin</span>
<span class="text-xs text-blue-400">(Owner)</span>
</div>
</div>
</div>
<!-- Bot Connection Status -->
<div id="botConnectionStatus" class="dashboard-card rounded-xl p-4 mb-6 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div id="connectionStatusIndicator" class="status-indicator status-offline"></div>
<span id="connectionStatusText" class="text-gray-300">Connecting to bot...</span>
</div>
<button id="refreshConnectionBtn" class="text-blue-400 hover:text-blue-300 text-sm flex items-center">
<i class="fas fa-sync-alt mr-1"></i> Refresh
</button>
</div>
<!-- Template Builder Section -->
<div class="dashboard-card rounded-xl p-6 mb-8">
<div class="flex justify-between items-center mb-6">
<h2 class="title-font text-xl font-bold text-white">Create New Template</h2>
<button id="createServerBtn" class="px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium flex items-center space-x-2">
<i class="fas fa-plus"></i>
<span>Create Server</span>
</button>
</div>
<!-- Template Name -->
<div class="mb-6">
<label for="templateName" class="block text-sm font-medium text-gray-300 mb-2">Template Name</label>
<input type="text" id="templateName" class="w-full px-4 py-3 rounded-lg input-field text-white focus:outline-none" placeholder="My Awesome Server Template">
</div>
<!-- Template Tabs -->
<div class="border-b border-gray-700 mb-6">
<div class="flex space-x-4">
<button class="tab-button active" onclick="openTab(event, 'categoriesTab')">
<i class="fas fa-folder mr-2"></i> Categories
</button>
<button class="tab-button" onclick="openTab(event, 'channelsTab')">
<i class="fas fa-hashtag mr-2"></i> Channels
</button>
<button class="tab-button" onclick="openTab(event, 'rolesTab')">
<i class="fas fa-user-shield mr-2"></i> Roles
</button>
<button class="tab-button" onclick="openTab(event, 'settingsTab')">
<i class="fas fa-cog mr-2"></i> Settings
</button>
</div>
</div>
<!-- Categories Tab -->
<div id="categoriesTab" class="tab-content active">
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium text-gray-300">Server Structure</h3>
<button onclick="addCategory()" class="text-sm text-blue-400 hover:text-blue-300 flex items-center">
<i class="fas fa-plus mr-1"></i> Add Category
</button>
</div>
<div id="categoriesContainer" class="space-y-4">
<!-- Categories will be added here -->
</div>
</div>
<!-- Channels Tab -->
<div id="channelsTab" class="tab-content">
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium text-gray-300">Channel Configuration</h3>
<div class="dropdown relative">
<button class="text-sm text-blue-400 hover:text-blue-300 flex items-center">
<i class="fas fa-plus mr-1"></i> Add Channel
</button>
<div class="dropdown-content mt-2 p-2">
<a href="#" onclick="addTextChannel()" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700/50 rounded"><i class="fas fa-hashtag mr-2 text-blue-400"></i>Text Channel</a>
<a href="#" onclick="addVoiceChannel()" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700/50 rounded"><i class="fas fa-volume-up mr-2 text-green-400"></i>Voice Channel</a>
</div>
</div>
</div>
<div id="channelsContainer" class="space-y-4">
<!-- Channels will be added here -->
</div>
</div>
<!-- Roles Tab -->
<div id="rolesTab" class="tab-content">
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium text-gray-300">Role Configuration</h3>
<button onclick="addRole()" class="text-sm text-blue-400 hover:text-blue-300 flex items-center">
<i class="fas fa-plus mr-1"></i> Add Role
</button>
</div>
<div id="rolesContainer" class="space-y-4">
<!-- Roles will be added here -->
</div>
</div>
<!-- Settings Tab -->
<div id="settingsTab" class="tab-content">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="font-medium text-gray-300 mb-4">Server Settings</h3>
<div class="space-y-4">
<div>
<label class="block text-sm text-gray-400 mb-1">Server Region</label>
<select class="w-full px-4 py-2 rounded-lg input-field text-white focus:outline-none">
<option>North America</option>
<option>Europe</option>
<option>Asia</option>
</select>
</div>
<div>
<label class="block text-sm text-gray-400 mb-1">Verification Level</label>
<select class="w-full px-4 py-2 rounded-lg input-field text-white focus:outline-none">
<option>None</option>
<option>Low</option>
<option>Medium</option>
<option>High</option>
</select>
</div>
</div>
</div>
<div>
<h3 class="font-medium text-gray-300 mb-4">Default Notifications</h3>
<div class="space-y-4">
<div class="flex items-center">
<input type="checkbox" id="suppressEveryone" class="mr-2">
<label for="suppressEveryone" class="text-sm text-gray-300">Suppress @everyone and @here</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="suppressRoles" class="mr-2">
<label for="suppressRoles" class="text-sm text-gray-300">Suppress All Role @mentions</label>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Preview Section -->
<div class="dashboard-card rounded-xl p-6">
<h2 class="title-font text-xl font-bold text-white mb-4">Template Preview</h2>
<div id="templatePreview" class="bg-gray-900/50 rounded-lg p-4 min-h-40">
<p class="text-gray-500 text-center py-10">Your server structure will appear here as you build it</p>
</div>
</div>
</div>
</div>
<script>
// Bot configuration
const BOT_TOKEN = "MTM2ODM3ODM2MzIzNTc5OTA4MA.GgWxwc.0GUxt0uPBFpDiwlIJOza0GQq1nVwd_xx8f2_so";
const BOT_CLIENT_ID = "1368378363235799080";
const BOT_AVATAR_URL = `https://cdn.discordapp.com/avatars/${BOT_CLIENT_ID}/a_1e9a4c5e5e5e5e5e5e5e5e5e5e5e5e5.webp?size=80`;
// Toggle password visibility
function togglePasswordVisibility() {
const passwordInput = document.getElementById('password');
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
} else {
passwordInput.type = 'password';
}
}
// Check password
function checkPassword() {
const password = document.getElementById('password').value;
const errorElement = document.getElementById('errorMessage');
// Show loading state
document.getElementById('passwordForm').classList.add('hidden');
document.getElementById('loadingState').classList.remove('hidden');
// Simulate authentication
setTimeout(() => {
if (password === 'ServerDev!29') {
// Successful login
document.getElementById('loginScreen').classList.add('hidden');
document.getElementById('dashboardScreen').classList.remove('hidden');
initializeTemplateBuilder();
checkBotStatus();
} else {
// Show error
document.getElementById('loadingState').classList.add('hidden');
document.getElementById('passwordForm').classList.remove('hidden');
errorElement.textContent = 'Invalid password. Please try again.';
errorElement.classList.remove('hidden');
// Hide error after 5 seconds
setTimeout(() => {
errorElement.classList.add('hidden');
}, 5000);
}
}, 1500);
}
// Logout function
function logout() {
document.getElementById('dashboardScreen').classList.add('hidden');
document.getElementById('loginScreen').classList.remove('hidden');
// Reset forms
document.getElementById('password').value = '';
document.getElementById('loadingState').classList.add('hidden');
document.getElementById('errorMessage').classList.add('hidden');
}
// Tab switching
function openTab(evt, tabName) {
const tabContents = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabContents.length; i++) {
tabContents[i].classList.remove("active");
}
const tabButtons = document.getElementsByClassName("tab-button");
for (let i = 0; i < tabButtons.length; i++) {
tabButtons[i].classList.remove("active");
}
document.getElementById(tabName).classList.add("active");
evt.currentTarget.classList.add("active");
}
// Check bot status via Discord API
async function checkBotStatus() {
const statusIndicator = document.getElementById('connectionStatusIndicator');
const statusText = document.getElementById('connectionStatusText');
const botStatusIndicator = document.getElementById('botStatus');
const botStatusText = document.getElementById('botStatusText');
try {
statusText.textContent = "Checking bot status...";
statusIndicator.className = "status-indicator status-idle";
// Fetch bot user data
const response = await fetch(`https://discord.com/api/v10/users/${BOT_CLIENT_ID}`, {
headers: {
'Authorization': `Bot ${BOT_TOKEN}`
}
});
if (response.ok) {
const botData = await response.json();
// Update bot avatar
const botAvatar = document.getElementById('botAvatar');
if (botData.avatar) {
const avatarUrl = `https://cdn.discordapp.com/avatars/${BOT_CLIENT_ID}/${botData.avatar}.png?size=80`;
botAvatar.innerHTML = `<img src="${avatarUrl}" class="w-full h-full object-cover" alt="Bot Avatar">`;
} else {
botAvatar.innerHTML = `<i class="fas fa-robot text-white"></i>`;
}
// Check if bot is in any guilds (as a proxy for "is running")
const guildsResponse = await fetch(`https://discord.com/api/v10/users/@me/guilds`, {
headers: {
'Authorization': `Bot ${BOT_TOKEN}`
}
});
if (guildsResponse.ok) {
const guilds = await guildsResponse.json();
if (guilds.length > 0) {
// Bot is online and in at least one guild
statusIndicator.className = "status-indicator status-online";
statusText.textContent = "Bot is online and connected to Discord";
botStatusIndicator.className = "status-indicator status-online";
botStatusText.textContent = "Online";
} else {
// Bot is online but not in any guilds
statusIndicator.className = "status-indicator status-idle";
statusText.textContent = "Bot is online but not in any servers";
botStatusIndicator.className = "status-indicator status-idle";
botStatusText.textContent = "Idle";
}
} else {
// Error checking guilds
statusIndicator.className = "status-indicator status-dnd";
statusText.textContent = "Error checking bot guilds";
botStatusIndicator.className = "status-indicator status-dnd";
botStatusText.textContent = "Error";
}
} else {
// Bot is offline or token is invalid
statusIndicator.className = "status-indicator status-offline";
statusText.textContent = "Bot is offline or token is invalid";
botStatusIndicator.className = "status-indicator status-offline";
botStatusText.textContent = "Offline";
}
} catch (error) {
console.error("Error checking bot status:", error);
statusIndicator.className = "status-indicator status-dnd";
statusText.textContent = "Error connecting to Discord API";
botStatusIndicator.className = "status-indicator status-dnd";
botStatusText.textContent = "Error";
}
}
// Create a server from template
async function createServerFromTemplate() {
const templateName = document.getElementById('templateName').value || 'Unnamed Template';
// Get all categories and their channels
const categories = [];
const categoryElements = document.getElementById('categoriesContainer').children;
for (let category of categoryElements) {
const categoryName = category.querySelector('input').value || 'Unnamed Category';
const categoryChannels = [];
// Get channels in this category
const channelElements = category.querySelector('.category-channels').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
categoryChannels.push({
name: channelName,
type: isTextChannel ? 'text' : 'voice'
});
}
categories.push({
name: categoryName,
channels: categoryChannels
});
}
// Get standalone channels (not in categories)
const standaloneChannels = [];
const channelElements = document.getElementById('channelsContainer').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
standaloneChannels.push({
name: channelName,
type: isTextChannel ? 'text' : 'voice'
});
}
// Get roles
const roles = [];
const roleElements = document.getElementById('rolesContainer').children;
for (let role of roleElements) {
const roleName = role.querySelector('input').value || 'Unnamed Role';
const roleColor = role.querySelector('.role-color').style.backgroundColor;
roles.push({
name: roleName,
color: roleColor
});
}
// Prepare the server creation payload
const payload = {
name: templateName,
categories: categories,
channels: standaloneChannels,
roles: roles
};
try {
// Show loading state
const createBtn = document.getElementById('createServerBtn');
createBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Creating Server...';
createBtn.disabled = true;
// In a real implementation, you would send this to your backend
// which would then use the bot token to create the server
console.log("Server creation payload:", payload);
// Simulate API call delay
await new Promise(resolve => setTimeout(resolve, 2000));
// Show success message
alert(`Server "${templateName}" created successfully!`);
// Reset button
createBtn.innerHTML = '<i class="fas fa-plus mr-2"></i> Create Server';
createBtn.disabled = false;
} catch (error) {
console.error("Error creating server:", error);
alert("Failed to create server: " + error.message);
// Reset button
const createBtn = document.getElementById('createServerBtn');
createBtn.innerHTML = '<i class="fas fa-plus mr-2"></i> Create Server';
createBtn.disabled = false;
}
}
// Template Builder Functions
function initializeTemplateBuilder() {
// Initialize sortable for all containers
new Sortable(document.getElementById('categoriesContainer'), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
new Sortable(document.getElementById('channelsContainer'), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
new Sortable(document.getElementById('rolesContainer'), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
// Add event listener for refresh button
document.getElementById('refreshConnectionBtn').addEventListener('click', checkBotStatus);
// Add event listener for create server button
document.getElementById('createServerBtn').addEventListener('click', createServerFromTemplate);
// Add some default items
addDefaultAdminRole();
addDefaultCategory();
}
function addCategory() {
const categoriesContainer = document.getElementById('categoriesContainer');
const categoryId = 'category-' + Date.now();
const categoryHtml = `
<div class="template-item" id="${categoryId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon category-channel">
<i class="fas fa-folder text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="New Category" placeholder="Category Name">
</div>
<div class="flex space-x-2">
<button onclick="addChannelToCategory('${categoryId}')" class="text-xs text-blue-400 hover:text-blue-300">
<i class="fas fa-plus"></i> Channel
</button>
<button onclick="document.getElementById('${categoryId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="category-channels mt-3 ml-8 pl-4 border-l border-gray-700 space-y-3" id="${categoryId}-channels"></div>
</div>
`;
categoriesContainer.insertAdjacentHTML('beforeend', categoryHtml);
// Make the channels inside this category sortable
new Sortable(document.getElementById(`${categoryId}-channels`), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
updatePreview();
}
function addDefaultCategory() {
const categoriesContainer = document.getElementById('categoriesContainer');
const categoryId = 'category-default';
const categoryHtml = `
<div class="template-item" id="${categoryId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon category-channel">
<i class="fas fa-folder text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="General" placeholder="Category Name">
</div>
<div class="flex space-x-2">
<button onclick="addChannelToCategory('${categoryId}')" class="text-xs text-blue-400 hover:text-blue-300">
<i class="fas fa-plus"></i> Channel
</button>
<button onclick="document.getElementById('${categoryId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="category-channels mt-3 ml-8 pl-4 border-l border-gray-700 space-y-3" id="${categoryId}-channels"></div>
</div>
`;
categoriesContainer.insertAdjacentHTML('beforeend', categoryHtml);
// Make the channels inside this category sortable
new Sortable(document.getElementById(`${categoryId}-channels`), {
animation: 150,
ghostClass: 'dragging',
onEnd: updatePreview
});
// Add default channels
addTextChannelToCategory(categoryId, 'welcome');
addTextChannelToCategory(categoryId, 'general');
addVoiceChannelToCategory(categoryId, 'General Voice');
updatePreview();
}
function addChannelToCategory(categoryId) {
const dropdownHtml = `
<div class="absolute left-0 mt-1 w-48 bg-gray-800 rounded-md shadow-lg z-10 border border-gray-700">
<div class="py-1">
<a href="#" onclick="addTextChannelToCategory('${categoryId}'); return false;" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700">
<i class="fas fa-hashtag mr-2 text-blue-400"></i> Text Channel
</a>
<a href="#" onclick="addVoiceChannelToCategory('${categoryId}'); return false;" class="block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700">
<i class="fas fa-volume-up mr-2 text-green-400"></i> Voice Channel
</a>
</div>
</div>
`;
// Create and show dropdown
const dropdown = document.createElement('div');
dropdown.innerHTML = dropdownHtml;
dropdown.className = 'origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg';
dropdown.id = 'channel-type-dropdown';
const button = event.currentTarget;
button.parentNode.appendChild(dropdown);
// Close dropdown when clicking elsewhere
document.addEventListener('click', function closeDropdown(e) {
if (!dropdown.contains(e.target) && e.target !== button) {
dropdown.remove();
document.removeEventListener('click', closeDropdown);
}
});
}
function addTextChannel() {
const channelsContainer = document.getElementById('channelsContainer');
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon text-channel">
<i class="fas fa-hashtag text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="new-text-channel" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addVoiceChannel() {
const channelsContainer = document.getElementById('channelsContainer');
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon voice-channel">
<i class="fas fa-volume-up text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="new-voice-channel" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addTextChannelToCategory(categoryId, defaultName = 'new-text-channel') {
const channelsContainer = document.getElementById(`${categoryId}-channels`);
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon text-channel">
<i class="fas fa-hashtag text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="${defaultName}" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addVoiceChannelToCategory(categoryId, defaultName = 'new-voice-channel') {
const channelsContainer = document.getElementById(`${categoryId}-channels`);
const channelId = 'channel-' + Date.now();
const channelHtml = `
<div class="template-item" id="${channelId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="channel-icon voice-channel">
<i class="fas fa-volume-up text-xs"></i>
</div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="${defaultName}" placeholder="Channel Name">
</div>
<div class="flex space-x-2">
<button onclick="configureChannelPermissions('${channelId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${channelId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
channelsContainer.insertAdjacentHTML('beforeend', channelHtml);
updatePreview();
}
function addRole() {
const rolesContainer = document.getElementById('rolesContainer');
const roleId = 'role-' + Date.now();
const roleHtml = `
<div class="template-item" id="${roleId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="role-color" style="background-color: #${Math.floor(Math.random()*16777215).toString(16)}"></div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="New Role" placeholder="Role Name">
</div>
<div class="flex space-x-2">
<button onclick="configureRolePermissions('${roleId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${roleId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`;
rolesContainer.insertAdjacentHTML('beforeend', roleHtml);
updatePreview();
}
function addDefaultAdminRole() {
const rolesContainer = document.getElementById('rolesContainer');
const roleId = 'role-admin';
const roleHtml = `
<div class="template-item" id="${roleId}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="role-color" style="background-color: #ff0000"></div>
<input type="text" class="bg-transparent border-b border-gray-600 focus:border-blue-500 focus:outline-none px-1 py-1 text-white" value="Admin" placeholder="Role Name">
</div>
<div class="flex space-x-2">
<button onclick="configureRolePermissions('${roleId}')" class="text-xs text-yellow-400 hover:text-yellow-300">
<i class="fas fa-lock"></i> Perms
</button>
<button onclick="document.getElementById('${roleId}').remove(); updatePreview()" class="text-xs text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="mt-2">
<span class="permission-chip">Administrator</span>
</div>
</div>
`;
rolesContainer.insertAdjacentHTML('beforeend', roleHtml);
updatePreview();
}
function configureChannelPermissions(channelId) {
alert('Channel permission configuration would go here for: ' + channelId);
// In a real implementation, this would open a modal with permission checkboxes
}
function configureRolePermissions(roleId) {
alert('Role permission configuration would go here for: ' + roleId);
// In a real implementation, this would open a modal with permission checkboxes
}
function updatePreview() {
const previewContainer = document.getElementById('templatePreview');
// Get template name
const templateName = document.getElementById('templateName').value || 'Unnamed Template';
// Get categories and their channels
let categoriesHtml = '';
const categoryElements = document.getElementById('categoriesContainer').children;
for (let category of categoryElements) {
const categoryName = category.querySelector('input').value || 'Unnamed Category';
// Get channels in this category
let channelsHtml = '';
const channelElements = category.querySelector('.category-channels').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
channelsHtml += `
<div class="flex items-center py-1 pl-6">
<div class="${isTextChannel ? 'text-blue-400' : 'text-green-400'} mr-2">
<i class="fas ${isTextChannel ? 'fa-hashtag' : 'fa-volume-up'}"></i>
</div>
<span class="text-gray-300">${channelName}</span>
</div>
`;
}
categoriesHtml += `
<div class="mb-4">
<div class="flex items-center py-2 border-b border-gray-700">
<div class="text-yellow-400 mr-2">
<i class="fas fa-folder"></i>
</div>
<span class="font-medium text-gray-200">${categoryName}</span>
</div>
${channelsHtml}
</div>
`;
}
// Get standalone channels (not in categories)
let standaloneChannelsHtml = '';
const channelElements = document.getElementById('channelsContainer').children;
for (let channel of channelElements) {
const channelName = channel.querySelector('input').value || 'Unnamed Channel';
const isTextChannel = channel.querySelector('.text-channel') !== null;
standaloneChannelsHtml += `
<div class="flex items-center py-1">
<div class="${isTextChannel ? 'text-blue-400' : 'text-green-400'} mr-2">
<i class="fas ${isTextChannel ? 'fa-hashtag' : 'fa-volume-up'}"></i>
</div>
<span class="text-gray-300">${channelName}</span>
</div>
`;
}
if (standaloneChannelsHtml) {
categoriesHtml += `
<div class="mb-4">
<div class="flex items-center py-2 border-b border-gray-700">
<span class="font-medium text-gray-200">Standalone Channels</span>
</div>
${standaloneChannelsHtml}
</div>
`;
}
// Get roles
let rolesHtml = '';
const roleElements = document.getElementById('rolesContainer').children;
for (let role of roleElements) {
const roleName = role.querySelector('input').value || 'Unnamed Role';
const roleColor = role.querySelector('.role-color').style.backgroundColor;
rolesHtml += `
<div class="flex items-center py-1">
<div class="w-3 h-3 rounded-full mr-2" style="background-color: ${roleColor}"></div>
<span class="text-gray-300">${roleName}</span>
</div>
`;
}
// Update preview
previewContainer.innerHTML = `
<h3 class="text-lg font-bold text-white mb-4">${templateName}</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="md:col-span-2">
<h4 class="text-md font-medium text-gray-300 mb-2">Server Structure</h4>
${categoriesHtml || '<p class="text-gray-500">No categories or channels added yet</p>'}
</div>
<div>
<h4 class="text-md font-medium text-gray-300 mb-2">Roles</h4>
${rolesHtml || '<p class="text-gray-500">No roles added yet</p>'}
</div>
</div>
`;
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=TutorialMentor/serverdev" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |