···1717 className?: string;
18181919 name: string;
2020- url: string;
2121- dataName: string;
2020+ url?: string;
2121+ dataName?: string;
2222 disabled?: boolean;
2323 description?: string;
2424 defaultState: number;
25252626 min?: number;
2727 max?: number;
2828+2929+ onSave?: (state: number) => void;
2830}
29313032export default function NumberInput({
···3537 disabled,
3638 description,
3739 defaultState,
4040+3841 min = 0,
3939- max = Infinity
4242+ max = Infinity,
4343+4444+ onSave
4045}: Props) {
4146 const web = webStore((w) => w);
4247···4752 const intervalRef = useRef<NodeJS.Timeout | null>(null);
48534954 const [value, setValue] = useState<number>();
5050- const [defaultStatealue, _setDefaultalue] = useState<number>();
5555+ const [def, setDef] = useState<number>();
51565257 useEffect(() => {
5358 if (!hold) {
···79848085 useEffect(() => {
8186 setValue(defaultState);
8282- _setDefaultalue(defaultState);
8787+ setDef(defaultState);
8388 }, [defaultState]);
84898590 function handleSave() {
8686- if (defaultStatealue === value) return;
9191+ if (def === value || !value) return;
8792 setError(undefined);
8893 setState(State.Loading);
89949595+ if (!url) {
9696+ if (!onSave) {
9797+ setValue(def);
9898+ throw new Error("Warning: <Switch.onSave> must be defined when not using <Switch.url>.");
9999+ }
100100+101101+ setState(State.Idle);
102102+ setDef(value);
103103+ return;
104104+ }
105105+106106+ if (!dataName) {
107107+ setValue(def);
108108+ throw new Error("Warning: <Switch.dataName> must be defined when using <Switch.url>.");
109109+ }
110110+90111 fetch(`${process.env.NEXT_PUBLIC_API}${url}`, {
91112 method: "PATCH",
92113 credentials: "include",
···105126106127 switch (res.status) {
107128 case 200: {
129129+ onSave?.(value);
130130+ setDef(value);
131131+108132 setState(State.Success);
109109- _setDefaultalue(value);
110133 setTimeout(() => setState(State.Idle), 1_000 * 8);
111134 break;
112135 }
···146169 (state === State.Loading || disabled) && "opacity-50"
147170 )}
148171 >
149149- {defaultStatealue !== value &&
172172+ {def !== value &&
150173 <Button
151174 onClick={handleSave}
152175 className="mr-2"
+3-2
public/docs/starboard.md
···881. Install Wamellow on your server by going to [wamellow.com/add](https://wamellow.com/add).
992. Head to the dashboard by going to [wamellow.com/dashboard](https://wamellow.com/dashboard?to=starboard).
10103. Select your server from the dashboard.
1111-4. Navigate to the **Starboard** menu.
1111+4. Navigate to the **Starboard** menu.
12125. Enable the Starboard module by clicking the enable button.
13136. Select a channel for messages to be posted into.
14147. **🎉 Done!** Try it out by reacting to any message with the selected emote.
···4848- Username (`@mwlica`)
4949- Global Nickname (`yll`)
5050- Guild Nickname (`Luna`)
5151-- Guild Nickname & Per-Guild Avatar
5151+- Guild Nickname & Per-Guild Avatar (`Luna`)
5252+- Anonymous (removes the username & avatar)
52535354### 🤚 Blacklist roles
5455Specify roles that are restricted from starring other people's messages and prevent their own messages from appearing on the starboard.