Aryxst
Aryxst
Explore posts from servers
SSolidJS
Created by Aryxst on 9/22/2024 in #support
fix function running only on build
I want to load the function from this file on mount https://github.com/Aryxst/tauri-app/blob/master/src/use-controller.tsx in home.tsx:
import { onMount } from 'solid-js';
import useController from '../use-controller';

function Home() {
onMount(() => {
useController()
.on('pad-a-down', () => {
console.log('A is down!');
})
.on('pad-a-up', () => {
console.log('A is up!');
})
.on('pad-b-down', () => {
console.log('B is down!');
})
.on('pad-b-up', () => {
console.log('B is up!');
})
.on('pad-x-down', () => {
console.log('X is down!');
})
.on('pad-x-up', () => {
console.log('X is up!');
})
.on('pad-y-down', () => {
console.log('Y is down!');
})
.on('pad-y-up', () => {
console.log('Y is up!');
});
});

return <div>Hello World!</div>;
}

export default Home;
import { onMount } from 'solid-js';
import useController from '../use-controller';

function Home() {
onMount(() => {
useController()
.on('pad-a-down', () => {
console.log('A is down!');
})
.on('pad-a-up', () => {
console.log('A is up!');
})
.on('pad-b-down', () => {
console.log('B is down!');
})
.on('pad-b-up', () => {
console.log('B is up!');
})
.on('pad-x-down', () => {
console.log('X is down!');
})
.on('pad-x-up', () => {
console.log('X is up!');
})
.on('pad-y-down', () => {
console.log('Y is down!');
})
.on('pad-y-up', () => {
console.log('Y is up!');
});
});

return <div>Hello World!</div>;
}

export default Home;
Why does this work on build?
1 replies
DTDrizzle Team
Created by Aryxst on 5/16/2024 in #help
LibsqlError: URL_INVALID: The URL is not in a valid format
Out of nowhere I started getting this error, whats even weiirder is that it only occurs on one route. /posts/create
16 replies
DTDrizzle Team
Created by Aryxst on 5/13/2024 in #help
Setting default timestamp in user table
So Im using turso with sqlite and out of nowhere i have been issuing this issue with my user table, im using nextauthjs
import { sql } from 'drizzle-orm';
import { sqliteTable, text, primaryKey, integer, int } from 'drizzle-orm/sqlite-core';
import type { AdapterAccountType } from 'next-auth/adapters';
import { createId } from '@paralleldrive/cuid2';

export const user = sqliteTable('user', {
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
name: text('name'),
email: text('email').notNull(),
emailVerified: integer('emailVerified', { mode: 'timestamp_ms' }),
image: text('image'),
role: text('role').$type<'USER' | 'ADMIN'>().notNull().default('USER'),
joinedAt: integer('joinedAt', { mode: 'timestamp_ms' })
.notNull()
.$defaultFn(() => sql`(unixepoch() * 1000)`),
});
import { sql } from 'drizzle-orm';
import { sqliteTable, text, primaryKey, integer, int } from 'drizzle-orm/sqlite-core';
import type { AdapterAccountType } from 'next-auth/adapters';
import { createId } from '@paralleldrive/cuid2';

export const user = sqliteTable('user', {
id: text('id')
.primaryKey()
.$defaultFn(() => createId()),
name: text('name'),
email: text('email').notNull(),
emailVerified: integer('emailVerified', { mode: 'timestamp_ms' }),
image: text('image'),
role: text('role').$type<'USER' | 'ADMIN'>().notNull().default('USER'),
joinedAt: integer('joinedAt', { mode: 'timestamp_ms' })
.notNull()
.$defaultFn(() => sql`(unixepoch() * 1000)`),
});
2 replies
SSolidJS
Created by Aryxst on 3/13/2024 in #support
How do i make a list properly reactive to state changes?
So I have this for loops that iterates in an array of data fetched on page load, i devided the sorting functions in 2 categories checkerFunctions that check a checkbox value, and filterFunctions that check a object value in a signal. The filterFunctions steps works just fine, but i don't know why the checkFunctions don't. Am i assigning a bool wrongfully?
const checkerFunctions = {
NotUserCreator: item => item.Creator.Id == userId,
};
const filterFunctions = {
robux: item => {
return item.Product.PriceInRobux >= activeFilters().robux.min && item.Product.PriceInRobux <= activeFilters().robux.max;
},
};
const [activeFilters, setActiveFilters] = createSignal({
...Object.fromEntries(
Object.entries(checkerFunctions).map(([key]) => {
return [key, false];
}),
),
robux: { min: 0, max: Infinity },
NotUserCreator: false,
});

const FiltersComponent = () => (
<div>
<h2>Filters:</h2>
<hr />
{Object.keys(checkerFunctions).map(key => {
return (
<div>
<input type='checkbox' checked={activeFilters()?.[key]} onChange={() => setActiveFilters(pre => ({ ...pre, [key]: !pre[key] }))} />
<label for={key}>{key}</label>
</div>
);
})}
<h2>Robux</h2>
<div>
<div>
<label>Min:</label>
<input
onInput={e => {
numericInput(e);
setActiveFilters(pre => ({ ...pre, robux: { max: pre.robux.max, min: Number(e.currentTarget.value) } }));
if (!e.target.value) {
setActiveFilters(pre => ({ ...pre, robux: { max: pre.robux.max, min: 0 } }));
}
}}

/>
</div>

<div>
<label>Max:</label>
<input
onInput={e => {
numericInput(e);
setActiveFilters(pre => ({ ...pre, robux: { min: pre.robux.min, max: Number(e.currentTarget.value) } }));
if (!e.target.value) {
setActiveFilters(pre => ({ ...pre, robux: { min: pre.robux.min, max: Infinity } }));
}
}}
/>
</div>
</div>
</div>
);
const checkerFunctions = {
NotUserCreator: item => item.Creator.Id == userId,
};
const filterFunctions = {
robux: item => {
return item.Product.PriceInRobux >= activeFilters().robux.min && item.Product.PriceInRobux <= activeFilters().robux.max;
},
};
const [activeFilters, setActiveFilters] = createSignal({
...Object.fromEntries(
Object.entries(checkerFunctions).map(([key]) => {
return [key, false];
}),
),
robux: { min: 0, max: Infinity },
NotUserCreator: false,
});

const FiltersComponent = () => (
<div>
<h2>Filters:</h2>
<hr />
{Object.keys(checkerFunctions).map(key => {
return (
<div>
<input type='checkbox' checked={activeFilters()?.[key]} onChange={() => setActiveFilters(pre => ({ ...pre, [key]: !pre[key] }))} />
<label for={key}>{key}</label>
</div>
);
})}
<h2>Robux</h2>
<div>
<div>
<label>Min:</label>
<input
onInput={e => {
numericInput(e);
setActiveFilters(pre => ({ ...pre, robux: { max: pre.robux.max, min: Number(e.currentTarget.value) } }));
if (!e.target.value) {
setActiveFilters(pre => ({ ...pre, robux: { max: pre.robux.max, min: 0 } }));
}
}}

/>
</div>

<div>
<label>Max:</label>
<input
onInput={e => {
numericInput(e);
setActiveFilters(pre => ({ ...pre, robux: { min: pre.robux.min, max: Number(e.currentTarget.value) } }));
if (!e.target.value) {
setActiveFilters(pre => ({ ...pre, robux: { min: pre.robux.min, max: Infinity } }));
}
}}
/>
</div>
</div>
</div>
);
3 replies
DIAdiscord.js - Imagine an app
Created by Aryxst on 2/13/2024 in #djs-questions
Send message to specific channel
How can I send a message to a specific channel of my guild?
19 replies
DIAdiscord.js - Imagine an app
Created by Aryxst on 2/8/2024 in #djs-questions
I don't know how to register commands
A while ago i created a discord bot with only one command, and i think i lost some files. The only command that works is ping, do i have to register the cother commands in some way? And if so, how?
Here's the source code. https://github.com/Aryxst/efestus-bot
4 replies