-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
index.tsx
133 lines (116 loc) · 3.48 KB
/
index.tsx
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
import { createStyles, Container, Title, Button, Group, Text, Center, Box, useMantineColorScheme } from '@mantine/core';
import Image from 'next/future/image';
import Link from 'next/link';
import { FiExternalLink } from 'react-icons/fi';
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
import { vscDarkPlus, ghcolors } from 'react-syntax-highlighter/dist/cjs/styles/prism';
const useStyles = createStyles((theme) => ({
outer: {
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'center',
gap: 50,
padding: 32,
[theme.fn.smallerThan('md')]: {
height: 'unset',
},
},
inner: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
[theme.fn.smallerThan('md')]: {
flexDirection: 'column',
gap: 50,
},
},
content: {
maxWidth: 480,
marginRight: theme.spacing.xl,
[theme.fn.smallerThan('md')]: {
marginRight: 0,
},
},
title: {
color: theme.colorScheme === 'dark' ? theme.white : theme.black,
fontSize: 44,
lineHeight: 1.2,
fontWeight: 900,
[theme.fn.smallerThan('xs')]: {
fontSize: 28,
},
},
highlight: {
position: 'relative',
backgroundColor: theme.fn.variant({ variant: 'light', color: theme.primaryColor }).background,
borderRadius: theme.radius.sm,
padding: '4px 12px',
},
}));
export default function IndexRoute() {
const { classes } = useStyles();
const { colorScheme } = useMantineColorScheme();
return (
<Container className={classes.outer} size="lg">
<Box className={classes.inner}>
<Box className={classes.content}>
<Title className={classes.title}>
The <span className={classes.highlight}>most popular</span> way to build Discord <br /> bots.
</Title>
<Text color="dimmed" mt="md">
discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It
takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code
significantly tidier and easier to comprehend.
</Text>
<Group mt={30}>
<Link href="/docs" passHref prefetch={false}>
<Button component="a" radius="sm" size="md">
Docs
</Button>
</Link>
<Link href="https://discordjs.guide" passHref prefetch={false}>
<Button component="a" variant="default" radius="sm" size="md" rightIcon={<FiExternalLink />}>
Guide
</Button>
</Link>
</Group>
</Box>
<Box pb="xs">
<SyntaxHighlighter
wrapLongLines
language="typescript"
style={colorScheme === 'dark' ? vscDarkPlus : ghcolors}
codeTagProps={{ style: { fontFamily: 'JetBrains Mono' } }}
>
{`import { Client, GatewayIntentBits } from 'discord.js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.on('ready', () => {
console.log(\`Logged in as \${client.user.tag}!\`);
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
await client.login('token');`}
</SyntaxHighlighter>
</Box>
</Box>
<Center>
<Link href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss" prefetch={false}>
<a title="Vercel">
<Image
src="/powered-by-vercel.svg"
alt="Vercel"
width={0}
height={0}
style={{ height: '100%', width: '100%', maxWidth: 250 }}
/>
</a>
</Link>
</Center>
</Container>
);
}