addXPバージョン: v2.0
目次
addXP()
この関数は、ユーザーに XP を追加するために使用します。
xpData には数値、または { min, max } を持つオブジェクトを指定できます。範囲指定の値は有限数であり、min <= max を満たす必要があります。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | ✅ | ユーザーの ID。 |
| guildId | string | ✅ | ギルド ID。 |
| xpData | number {min, max} |
✅ | 追加する XP の量。 |
| username | string | ❌ | auto_create が有効な場合に使うユーザー名。 |
- Promise<
XpResult>
XpFatal- 無効なパラメーターが渡された場合。
[JS] 例
Section titled “[JS] 例”const {addXP} = require('simply-xp');
const userid = "326815959358898189";const guildid = "867999056172052551";const username = "Abadima";const xp = 10000000; // or xp = {min: 5000000, max: 10000000}
addXP(userid, guildid, xp, username) .then(console.log) // Returns the user object .catch((err) => console.log(err)); // Returns the error