Configuration.cs
1 using ArgsUniform; 2 using System.Numerics; 3 4 namespace BiblioTech 5 { 6 public class Configuration 7 { 8 [Uniform("token", "t", "TOKEN", true, "Discord Application Token")] 9 public string ApplicationToken { get; set; } = string.Empty; 10 11 [Uniform("server-id", "sn", "SERVERID", true, "ID of the Discord server")] 12 public ulong ServerId { get; set; } 13 14 [Uniform("datapath", "dp", "DATAPATH", true, "Root path where all data files will be saved.")] 15 public string DataPath { get; set; } = "datapath"; 16 17 [Uniform("admin-role-id", "a", "ADMINROLEID", true, "ID of the Discord server admin role")] 18 public ulong AdminRoleId { get; set; } 19 20 [Uniform("admin-channel-id", "ac", "ADMINCHANNELID", true, "ID of the Discord server channel where admin commands are allowed.")] 21 public ulong AdminChannelId{ get; set; } 22 23 [Uniform("rewards-channel-id", "rc", "REWARDSCHANNELID", false, "ID of the Discord server channel where participation rewards will be announced.")] 24 public ulong RewardsChannelId { get; set; } 25 26 [Uniform("chain-events-channel-id", "cc", "CHAINEVENTSCHANNELID", false, "ID of the Discord server channel where chain events will be posted.")] 27 public ulong ChainEventsChannelId { get; set; } 28 29 [Uniform("reward-api-port", "rp", "REWARDAPIPORT", true, "TCP listen port for the reward API.")] 30 public int RewardApiPort { get; set; } = 31080; 31 32 [Uniform("send-eth", "se", "SENDETH", true, "Amount of Eth send by the mint command.")] 33 public decimal SendEth { get; set; } = 10.0m; 34 35 [Uniform("mint-tt", "mt", "MINTTT", true, "Amount of TSTWEI minted by the mint command.")] 36 public BigInteger MintTT { get; set; } = 1073741824; 37 38 [Uniform("send-tt", "st", "SENDTT", true, "Amount of TSTWEI sent from the bot account by the mint command.")] 39 public BigInteger SendTT { get; set; } = 1073741824; 40 41 [Uniform("no-discord", "nd", "NODISCORD", false, "For debugging: Bypasses all Discord API calls.")] 42 public int NoDiscord { get; set; } = 0; 43 44 [Uniform("codex-endpoint", "ce", "CODEXENDPOINT", false, "Codex endpoint. (default 'http://localhost:8080')")] 45 public string CodexEndpoint { get; set; } = "http://localhost:8080"; 46 47 [Uniform("codex-endpoint-auth", "cea", "CODEXENDPOINTAUTH", false, "Codex endpoint basic auth. Colon separated username and password. (default: empty, no auth used.)")] 48 public string CodexEndpointAuth { get; set; } = ""; 49 50 [Uniform("transaction-link-format", "tlf", "TRANSACTIONLINKFORMAT", false, "Format of links to transactions on the blockchain. Use '<ID>' to inject the transaction ID into this string. (default 'https://explorer.testnet.codex.storage/tx/<ID>')")] 51 public string TransactionLinkFormat { get; set; } = "https://explorer.testnet.codex.storage/tx/<ID>"; 52 53 #region Role Rewards 54 55 /// <summary> 56 /// Awarded when both checkupload and checkdownload have been completed. 57 /// </summary> 58 [Uniform("altruistic-role-id", "ar", "ALTRUISTICROLE", true, "ID of the Discord server role for Altruistic Mode.")] 59 public ulong AltruisticRoleId { get; set; } 60 61 /// <summary> 62 /// Awarded as long as either checkupload or checkdownload were completed within the last ActiveP2pRoleDuration minutes. 63 /// </summary> 64 [Uniform("active-p2p-role-id", "apri", "ACTIVEP2PROLEID", false, "ID of discord server role for active p2p participants.")] 65 public ulong ActiveP2pParticipantRoleId { get; set; } 66 67 [Uniform("active-p2p-role-duration", "aprd", "ACTIVEP2PROLEDURATION", false, "Duration in minutes for the active p2p participant role from the last successful check command.")] 68 public int ActiveP2pRoleDurationMinutes { get; set; } 69 70 /// <summary> 71 /// Awarded as long as the user is hosting at least 1 slot. 72 /// </summary> 73 [Uniform("active-host-role-id", "ahri", "ACTIVEHOSTROLEID", false, "Id of discord server role for active slot hosters.")] 74 public ulong ActiveHostRoleId { get; set; } 75 76 /// <summary> 77 /// Awarded as long as the user has at least 1 active storage purchase contract. 78 /// </summary> 79 [Uniform("active-client-role-id", "acri", "ACTIVECLIENTROLEID", false, "Id of discord server role for users with at least 1 active purchase contract.")] 80 public ulong ActiveClientRoleId { get; set; } 81 82 #endregion 83 84 public string EndpointsPath => Path.Combine(DataPath, "endpoints"); 85 public string UserDataPath => Path.Combine(DataPath, "users"); 86 public string ChecksDataPath => Path.Combine(DataPath, "checks"); 87 public string LogPath => Path.Combine(DataPath, "logs"); 88 public bool DebugNoDiscord => NoDiscord == 1; 89 } 90 }