Skip to content

Commit 2c96dba

Browse files
committed
feat: add more example templates
1 parent 804854e commit 2c96dba

33 files changed

+149
-150
lines changed

examples/with-ai/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
"@types/node": "^24.0.1",
2525
"typescript": "^5.8.3"
2626
}
27-
}
27+
}

examples/with-ai/src/app/commands/channel.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ export const ai: AiCommand<typeof aiConfig> = async (ctx) => {
105105
permissionOverwrites,
106106
};
107107

108-
const newChannel = await ctx.message.guild.channels.create(
109-
channelOptions
110-
);
108+
const newChannel =
109+
await ctx.message.guild.channels.create(channelOptions);
111110
createdChannels.push(newChannel);
112111
} catch (err) {
113112
const error = err as Error;

examples/with-ai/src/app/commands/poll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const pollMediaObject = z
4444
.describe('An optional emoji associated with the poll question. Eg: 👍'),
4545
})
4646
.describe(
47-
'An object representing the media for a poll question, containing the text of the question. Emoji cannot be used in question text.'
47+
'An object representing the media for a poll question, containing the text of the question. Emoji cannot be used in question text.',
4848
);
4949

5050
export const aiConfig = {

examples/with-ai/src/app/commands/remind.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const aiConfig = {
3030
time: z
3131
.string()
3232
.describe(
33-
'The time to remind after. Example: 10s, 10m, 10h, 10d, 10w, 10y'
33+
'The time to remind after. Example: 10s, 10m, 10h, 10d, 10w, 10y',
3434
),
3535
message: z
3636
.string()
@@ -75,7 +75,7 @@ export const chatInput: ChatInputCommand = async (ctx) => {
7575
}
7676

7777
await ctx.interaction.reply(
78-
`Reminder set for <t:${Math.floor(timer! / 1000)}:R>`
78+
`Reminder set for <t:${Math.floor(timer! / 1000)}:R>`,
7979
);
8080
};
8181

@@ -102,7 +102,7 @@ export const message: MessageCommand = async (ctx) => {
102102
}
103103

104104
await ctx.message.reply(
105-
`Reminder set for <t:${Math.floor(timer! / 1000)}:R>`
105+
`Reminder set for <t:${Math.floor(timer! / 1000)}:R>`,
106106
);
107107
};
108108

@@ -125,7 +125,7 @@ export const ai: AiCommand<typeof aiConfig> = async (ctx) => {
125125

126126
return {
127127
success: `Reminder set for <t:${Math.floor(
128-
timer! / 1000
128+
timer! / 1000,
129129
)}:R>. Show this markdown to the user for live updates on discord.`,
130130
};
131131
};

examples/with-ai/src/app/commands/weather.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import weather from 'weather-js';
66

77
const findWeather = (
88
location: string,
9-
unit: 'C' | 'F'
9+
unit: 'C' | 'F',
1010
): Promise<weather.Weather> => {
1111
return new Promise((resolve, reject) => {
1212
weather.find({ search: location, degreeType: unit }, (err, result) => {
@@ -83,15 +83,15 @@ export const chatInput: ChatInputCommand = async (ctx) => {
8383
name: 'Wind Speed',
8484
value: weatherData.current.windspeed,
8585
inline: true,
86-
}
86+
},
8787
);
8888

8989
// Add forecast information
9090
const forecast = weatherData.forecast
9191
.slice(0, 3)
9292
.map(
9393
(day) =>
94-
`${day.shortday}: ${day.skytextday} (${day.low}°${unit} - ${day.high}°${unit})`
94+
`${day.shortday}: ${day.skytextday} (${day.low}°${unit} - ${day.high}°${unit})`,
9595
)
9696
.join('\n');
9797

@@ -109,7 +109,7 @@ export const chatInput: ChatInputCommand = async (ctx) => {
109109
await ctx.interaction.editReply({ embeds: [embed] });
110110
} catch (error) {
111111
await ctx.interaction.editReply(
112-
'Could not find weather information for that location.'
112+
'Could not find weather information for that location.',
113113
);
114114
}
115115
};
@@ -141,15 +141,15 @@ export const ai: AiCommand<typeof aiConfig> = async (ctx) => {
141141
name: 'Wind Speed',
142142
value: weatherData.current.windspeed,
143143
inline: true,
144-
}
144+
},
145145
);
146146

147147
// Add forecast information
148148
const forecast = weatherData.forecast
149149
.slice(0, 3)
150150
.map(
151151
(day) =>
152-
`${day.shortday}: ${day.skytextday} (${day.low}°${unit} - ${day.high}°${unit})`
152+
`${day.shortday}: ${day.skytextday} (${day.low}°${unit} - ${day.high}°${unit})`,
153153
)
154154
.join('\n');
155155

examples/with-ai/src/tools/generate-image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function generateImage(prompt: string) {
2121

2222
if (!response.ok) {
2323
throw new Error(
24-
`Failed to generate image: ${response.status} ${response.statusText}`
24+
`Failed to generate image: ${response.status} ${response.statusText}`,
2525
);
2626
}
2727

examples/with-ai/src/weather-js.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ declare module 'weather-js' {
3232

3333
export function find(
3434
options: { search: string; degreeType: 'C' | 'F' },
35-
callback: (err: Error | null, result: Weather[]) => void
35+
callback: (err: Error | null, result: Weather[]) => void,
3636
): void;
3737
}

examples/with-leveling-system/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
"prisma": "^6.8.2",
3333
"sharp": "^0.34.2"
3434
}
35-
}
35+
}

examples/with-leveling-system/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Font.loadDefault();
1111

1212
// set the prefix resolver for message commands
1313
commandkit.setPrefixResolver((message) =>
14-
message.inGuild() ? fetchGuildPrefix(message.guildId) : '!'
14+
message.inGuild() ? fetchGuildPrefix(message.guildId) : '!',
1515
);
1616

1717
setCacheProvider(new RedisCache(redis));

examples/with-leveling-system/src/app/commands/(leveling)/_rank.utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function createRankCard(
2323
level: { xp: number; level: number };
2424
rank: number;
2525
},
26-
target: User
26+
target: User,
2727
) {
2828
const { level, rank } = levelingData;
2929

@@ -33,7 +33,7 @@ async function createRankCard(
3333
forceStatic: true,
3434
extension: 'png',
3535
size: 512,
36-
})
36+
}),
3737
)
3838
.setCurrentXP(level.xp)
3939
.setRequiredXP(LevelingModule.calculateLevelXP(level.level))

0 commit comments

Comments
 (0)